[svn-commits] twilson: branch twilson/config_docs r370232 - in /team/twilson/config_docs: i...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 18 16:43:37 CDT 2012


Author: twilson
Date: Wed Jul 18 16:43:33 2012
New Revision: 370232

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=370232
Log:
Remove a previous silly bit of code that is no longer needed

Modified:
    team/twilson/config_docs/include/asterisk/xmldoc.h
    team/twilson/config_docs/main/xmldoc.c

Modified: team/twilson/config_docs/include/asterisk/xmldoc.h
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_docs/include/asterisk/xmldoc.h?view=diff&rev=370232&r1=370231&r2=370232
==============================================================================
--- team/twilson/config_docs/include/asterisk/xmldoc.h (original)
+++ team/twilson/config_docs/include/asterisk/xmldoc.h Wed Jul 18 16:43:33 2012
@@ -61,7 +61,7 @@
 		AST_STRING_FIELD(name);
 		/*! The type of the item */
 		AST_STRING_FIELD(type);
-		/*! Need the objectType for configInfo */
+		/*! Reference to another field */
 		AST_STRING_FIELD(ref);
 	);
 	/*! The next XML documentation item that matches the same name/item type */

Modified: team/twilson/config_docs/main/xmldoc.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/config_docs/main/xmldoc.c?view=diff&rev=370232&r1=370231&r2=370232
==============================================================================
--- team/twilson/config_docs/main/xmldoc.c (original)
+++ team/twilson/config_docs/main/xmldoc.c Wed Jul 18 16:43:33 2012
@@ -475,12 +475,10 @@
 	return match;
 }
 
-
 /*! \internal
  *  \brief Get the application/function node for 'name' application/function with language 'language'
  *         and module 'module' if we don't find any, get the first application
  *         with 'name' no matter which language or module.
- *  \param node A node to start from, otherwise look at all docroots
  *  \param type 'application', 'function', ...
  *  \param name Application or Function name.
  *  \param module Module item is in.
@@ -488,13 +486,20 @@
  *  \retval NULL on error.
  *  \retval A node of type ast_xml_node.
  */
-static struct ast_xml_node *_xmldoc_get_node(struct ast_xml_node *node, const char *type, const char *name, const char *module, const char *language)
-{
+static struct ast_xml_node *xmldoc_get_node(const char *type, const char *name, const char *module, const char *language)
+{
+	struct ast_xml_node *node = NULL;
+	struct ast_xml_node *first_match = NULL;
+	struct ast_xml_node *lang_match = NULL;
 	struct documentation_tree *doctree;
-	auto struct ast_xml_node *find_node(void); /* working around gcc bugs */
-	auto struct ast_xml_node *find_node(void) {
-		struct ast_xml_node *first_match = NULL;
-		struct ast_xml_node *lang_match = NULL;
+
+	AST_RWLIST_RDLOCK(&xmldoc_tree);
+	AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) {
+		/* the core xml documents have priority over thirdparty document. */
+		node = ast_xml_get_root(doctree->doc);
+		if (!node) {
+			break;
+		}
 
 		node = ast_xml_node_get_children(node);
 		while ((node = ast_xml_find_element(node, type, "name", name))) {
@@ -530,47 +535,26 @@
 
 		/* if we matched lang and module return this match */
 		if (node) {
-			return node;
+			break;
 		}
 
 		/* we didn't match lang and module, just return the first
 		 * result with a matching language if we have one */
 		if (lang_match) {
-			return lang_match;
+			node = lang_match;
+			break;
 		}
 
 		/* we didn't match with only the language, just return the
 		 * first match */
 		if (first_match) {
-			return first_match;
-		}
-		return NULL;
-	}
-
-	/* If we know where to start looking, just return what we find */
-	if (node) {
-		return find_node();
-	}
-
-	/* We don't know where to start, so look everywhere */
-	AST_RWLIST_RDLOCK(&xmldoc_tree);
-	AST_LIST_TRAVERSE(&xmldoc_tree, doctree, entry) {
-		/* the core xml documents have priority over thirdparty document. */
-		if (!(node = ast_xml_get_root(doctree->doc))) {
+			node = first_match;
 			break;
 		}
-		if ((node = find_node())) {
-			break;
-		}
 	}
 	AST_RWLIST_UNLOCK(&xmldoc_tree);
 
 	return node;
-}
-
-static struct ast_xml_node *xmldoc_get_node(const char *type, const char *name, const char *module, const char *language)
-{
-	return _xmldoc_get_node(NULL, type, name, module, language);
 }
 
 /*! \internal




More information about the svn-commits mailing list