Skip to content
Snippets Groups Projects
Commit 02733f32 authored by Luigi Rizzo's avatar Luigi Rizzo
Browse files

add a small new function to retrieve variables from a config

once we have a pointer to the category.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent c00d3374
Branches
Tags
No related merge requests found
...@@ -132,6 +132,13 @@ char *ast_category_browse(struct ast_config *config, const char *prev); ...@@ -132,6 +132,13 @@ char *ast_category_browse(struct ast_config *config, const char *prev);
*/ */
struct ast_variable *ast_variable_browse(const struct ast_config *config, const char *category); struct ast_variable *ast_variable_browse(const struct ast_config *config, const char *category);
/*!
* \brief given a pointer to a category, return the root variable.
* This is equivalent to ast_variable_browse(), but more efficient if we
* already have the struct ast_category * (e.g. from ast_category_get())
*/
struct ast_variable *ast_category_first(struct ast_category *cat);
/*! /*!
* \brief Gets a variable * \brief Gets a variable
* \param config which (opened) config to use * \param config which (opened) config to use
......
...@@ -587,6 +587,12 @@ static struct ast_category *next_available_category(struct ast_category *cat) ...@@ -587,6 +587,12 @@ static struct ast_category *next_available_category(struct ast_category *cat)
return cat; return cat;
} }
/*! return the first var of a category */
struct ast_variable *ast_category_first(struct ast_category *cat)
{
return (cat) ? cat->root : NULL;
}
struct ast_variable *ast_category_root(struct ast_config *config, char *cat) struct ast_variable *ast_category_root(struct ast_config *config, char *cat)
{ {
struct ast_category *category = ast_category_get(config, cat); struct ast_category *category = ast_category_get(config, cat);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment