mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Use int instead of bool as result
Prefer to use an int return from a function instead of bool because it can contain more info about failures.
This commit is contained in:
parent
e5e360d5df
commit
4d6ac37398
38 changed files with 308 additions and 297 deletions
|
|
@ -177,8 +177,6 @@ typedef int (*spa_handle_factory_enum_func_t) (const struct spa_handle_factory *
|
|||
*/
|
||||
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index);
|
||||
|
||||
void spa_handle_factory_register(const struct spa_handle_factory *factory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -264,6 +264,8 @@ static const struct spa_handle_factory logger_factory = {
|
|||
impl_enum_interface_info,
|
||||
};
|
||||
|
||||
int spa_handle_factory_register(const struct spa_handle_factory *factory);
|
||||
|
||||
static void reg(void) __attribute__ ((constructor));
|
||||
static void reg(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -778,6 +778,8 @@ static const struct spa_handle_factory loop_factory = {
|
|||
impl_enum_interface_info
|
||||
};
|
||||
|
||||
int spa_handle_factory_register(const struct spa_handle_factory *factory);
|
||||
|
||||
static void reg(void) __attribute__ ((constructor));
|
||||
static void reg(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -211,6 +211,8 @@ static const struct spa_handle_factory type_map_factory = {
|
|||
impl_enum_interface_info,
|
||||
};
|
||||
|
||||
int spa_handle_factory_register(const struct spa_handle_factory *factory);
|
||||
|
||||
static void reg(void) __attribute__ ((constructor));
|
||||
static void reg(void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -27,13 +27,15 @@
|
|||
static const struct spa_handle_factory *factories[MAX_FACTORIES];
|
||||
static int n_factories;
|
||||
|
||||
void
|
||||
spa_handle_factory_register(const struct spa_handle_factory *factory)
|
||||
int spa_handle_factory_register(const struct spa_handle_factory *factory)
|
||||
{
|
||||
if (n_factories < MAX_FACTORIES)
|
||||
factories[n_factories++] = factory;
|
||||
else
|
||||
else {
|
||||
fprintf(stderr, "too many factories\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue