PipeWire
1.6.4
Toggle main menu visibility
Loading...
Searching...
No Matches
result.h
Go to the documentation of this file.
1
/* Simple Plugin API */
2
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3
/* SPDX-License-Identifier: MIT */
4
5
#ifndef SPA_UTILS_RESULT_H
6
#define SPA_UTILS_RESULT_H
7
8
#include <errno.h>
9
10
#include <
spa/utils/defs.h
>
11
12
#ifdef __cplusplus
13
extern
"C"
{
14
#endif
15
20
25
26
#ifndef SPA_API_RESULT
27
#ifdef SPA_API_IMPL
28
#define SPA_API_RESULT SPA_API_IMPL
29
#else
30
#define SPA_API_RESULT static inline
31
#endif
32
#endif
33
34
35
#define SPA_ASYNC_BIT (1 << 30)
36
#define SPA_ASYNC_SEQ_MASK (SPA_ASYNC_BIT - 1)
37
#define SPA_ASYNC_MASK (~SPA_ASYNC_SEQ_MASK)
38
39
#define SPA_RESULT_IS_OK(res) ((res) >= 0)
40
#define SPA_RESULT_IS_ERROR(res) ((res) < 0)
41
#define SPA_RESULT_IS_ASYNC(res) (((res) & SPA_ASYNC_MASK) == SPA_ASYNC_BIT)
42
43
#define SPA_RESULT_ASYNC_SEQ(res) ((res) & SPA_ASYNC_SEQ_MASK)
44
#define SPA_RESULT_RETURN_ASYNC(seq) (SPA_ASYNC_BIT | SPA_RESULT_ASYNC_SEQ(seq))
45
46
SPA_API_RESULT
const
char
*
spa_strerror
(
int
err)
47
{
48
int
_err = -(err);
49
if
(
SPA_RESULT_IS_ASYNC
(err))
50
_err = EINPROGRESS;
51
return
strerror(_err);
52
}
53
57
58
#ifdef __cplusplus
59
}
/* extern "C" */
60
#endif
61
62
#endif
/* SPA_UTILS_RESULT_H */
defs.h
spa/utils/defs.h
SPA_API_RESULT
#define SPA_API_RESULT
Definition
result.h:37
spa_strerror
SPA_API_RESULT const char * spa_strerror(int err)
Definition
result.h:61
SPA_RESULT_IS_ASYNC
#define SPA_RESULT_IS_ASYNC(res)
Definition
result.h:54
spa
utils
result.h
Generated by
1.17.0