mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-03-27 07:58:02 -04:00
conf: Export snd_config_make_add()
Create the snd_config_mak_add() and export it for use in the Topology2.0 pre-processor in alsatplg. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
parent
10e2490023
commit
c90834b8d4
2 changed files with 43 additions and 0 deletions
|
|
@ -124,6 +124,8 @@ int snd_config_copy(snd_config_t **dst, snd_config_t *src);
|
||||||
|
|
||||||
int snd_config_make(snd_config_t **config, const char *key,
|
int snd_config_make(snd_config_t **config, const char *key,
|
||||||
snd_config_type_t type);
|
snd_config_type_t type);
|
||||||
|
int snd_config_make_add(snd_config_t **config, char *id,
|
||||||
|
snd_config_type_t type, snd_config_t *parent);
|
||||||
int snd_config_make_integer(snd_config_t **config, const char *key);
|
int snd_config_make_integer(snd_config_t **config, const char *key);
|
||||||
int snd_config_make_integer64(snd_config_t **config, const char *key);
|
int snd_config_make_integer64(snd_config_t **config, const char *key);
|
||||||
int snd_config_make_real(snd_config_t **config, const char *key);
|
int snd_config_make_real(snd_config_t **config, const char *key);
|
||||||
|
|
|
||||||
41
src/conf.c
41
src/conf.c
|
|
@ -2309,6 +2309,47 @@ int snd_config_make(snd_config_t **config, const char *id,
|
||||||
return _snd_config_make(config, &id1, type);
|
return _snd_config_make(config, &id1, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Creates a configuration node and add it to the parent node.
|
||||||
|
* \param[out] config The function puts the handle to the new node at
|
||||||
|
* the address specified by \a config.
|
||||||
|
* \param[in] id The id of the new node.
|
||||||
|
* \param[in] type The type of the new node.
|
||||||
|
* \param[in] parent handle for the parent node.
|
||||||
|
* \return Zero if successful, otherwise a negative error code.
|
||||||
|
*
|
||||||
|
* This functions creates a new node of the specified type.
|
||||||
|
* The new node has id \a id, which may be \c NULL.
|
||||||
|
* and adds it to the parent node.
|
||||||
|
*
|
||||||
|
* The value of the new node is zero (for numbers), or \c NULL (for
|
||||||
|
* strings and pointers), or empty (for compound nodes).
|
||||||
|
*
|
||||||
|
* \par Errors:
|
||||||
|
* <dl>
|
||||||
|
* <dt>-ENOMEM<dd>Out of memory.
|
||||||
|
* </dl>
|
||||||
|
*/
|
||||||
|
int snd_config_make_add(snd_config_t **config, char *id,
|
||||||
|
snd_config_type_t type, snd_config_t *parent)
|
||||||
|
{
|
||||||
|
char *id1;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
assert(config);
|
||||||
|
if (id) {
|
||||||
|
id1 = strdup(id);
|
||||||
|
if (!id1)
|
||||||
|
return -ENOMEM;
|
||||||
|
} else
|
||||||
|
id1 = NULL;
|
||||||
|
ret = _snd_config_make(config, &id1, type);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return snd_config_add(parent, *config);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Creates an integer configuration node.
|
* \brief Creates an integer configuration node.
|
||||||
* \param[out] config The function puts the handle to the new node at
|
* \param[out] config The function puts the handle to the new node at
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue