mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
conf: add snd_config_is_empty() function
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
da33eda632
commit
3050af4b90
2 changed files with 14 additions and 0 deletions
|
|
@ -141,6 +141,7 @@ int snd_config_imake_pointer(snd_config_t **config, const char *key, const void
|
|||
|
||||
snd_config_type_t snd_config_get_type(const snd_config_t *config);
|
||||
int snd_config_is_array(const snd_config_t *config);
|
||||
int snd_config_is_empty(const snd_config_t *config);
|
||||
|
||||
int snd_config_set_id(snd_config_t *config, const char *id);
|
||||
int snd_config_set_integer(snd_config_t *config, long value);
|
||||
|
|
|
|||
13
src/conf.c
13
src/conf.c
|
|
@ -1832,6 +1832,19 @@ int snd_config_is_array(const snd_config_t *config)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns if the compound has no fields (is empty).
|
||||
* \param config Handle to the configuration node.
|
||||
* \return A positive value when true, zero when false, otherwise a negative error code.
|
||||
*/
|
||||
int snd_config_is_empty(const snd_config_t *config)
|
||||
{
|
||||
assert(config);
|
||||
if (config->type != SND_CONFIG_TYPE_COMPOUND)
|
||||
return -EINVAL;
|
||||
return list_empty(&config->u.compound.fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns the id of a configuration node.
|
||||
* \param[in] config Handle to the configuration node.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue