[asterisk-commits] rizzo: trunk r89322 - in /trunk: include/asterisk/config.h main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 16 04:07:27 CST 2007


Author: rizzo
Date: Fri Nov 16 04:07:24 2007
New Revision: 89322

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89322
Log:
add a small new function to retrieve variables from a config
once we have a pointer to the category.


Modified:
    trunk/include/asterisk/config.h
    trunk/main/config.c

Modified: trunk/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/config.h?view=diff&rev=89322&r1=89321&r2=89322
==============================================================================
--- trunk/include/asterisk/config.h (original)
+++ trunk/include/asterisk/config.h Fri Nov 16 04:07:24 2007
@@ -131,6 +131,13 @@
  * \retval NULL on failure
  */
 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 

Modified: trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/trunk/main/config.c?view=diff&rev=89322&r1=89321&r2=89322
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Fri Nov 16 04:07:24 2007
@@ -585,6 +585,12 @@
 	for (; cat && cat->ignored; cat = cat->next);
 
 	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)




More information about the asterisk-commits mailing list