[asterisk-commits] bkruse: branch group/appdocsxml r128342 - /team/group/appdocsxml/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 6 00:09:20 CDT 2008


Author: bkruse
Date: Sun Jul  6 00:09:20 2008
New Revision: 128342

URL: http://svn.digium.com/view/asterisk?view=rev&rev=128342
Log:
mxml parsing is sorta b0rked, but I am going
to fix it tomorrow, goodnight!

Modified:
    team/group/appdocsxml/main/pbx.c

Modified: team/group/appdocsxml/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/appdocsxml/main/pbx.c?view=diff&rev=128342&r1=128341&r2=128342
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Sun Jul  6 00:09:20 2008
@@ -2615,7 +2615,6 @@
 static char *ast_mxml_get_field(const char *type, const char *name, const char *var) {
 	
 	char *fail = malloc(6);
-	char *tmp;
 	mxml_node_t *node, *lang_node, *ret;
 
 	node = lang_node = ret = NULL;
@@ -2634,7 +2633,6 @@
 	}
 
 	node = mxmlFindElement(documentation_tree, documentation_tree, type, "name", name, MXML_DESCEND);
-	//node = mxmlFindElement(documentation_tree, documentation_tree, "function", "name", "SHELL", MXML_DESCEND);
 
 	if (!node) {
 		ast_log(LOG_WARNING, "Cannot find Documentation name:'%s' type:'%s' var:'%s'\n", name, type, var);
@@ -2645,27 +2643,20 @@
 	
 	/* Could not find language, use the default one without a language */
 	if (!lang_node) {
-		lang_node = node;
-	}
-
-	ret = mxmlFindElement(lang_node, documentation_tree, var, NULL, NULL, MXML_DESCEND);
-    
+		ret = mxmlFindElement(node, documentation_tree, var, NULL, NULL, MXML_NO_DESCEND);
+	} else {
+		ret = mxmlFindElement(lang_node, documentation_tree, var, NULL, NULL, MXML_NO_DESCEND);
+	}
+
 	if (!ret || !ret->child) {
 		ast_log(LOG_WARNING, "Cannot find varible '%s' in tree '%s'\n", name, var);
 		return fail;
 	}
 
+	ast_log(LOG_ERROR, "a) '%s' \n\n b) '%s' \n\ntype: '%s', name:'%s', var:'%s'", ret->value.opaque, ret->child->value.opaque, type, name, var);
 	/* Dont need fail anymore */
 	free(fail);
-	tmp = malloc(sizeof(ret->child->value.opaque));
-	if(!tmp) {
-		ast_log(LOG_ERROR, "Malloc Failed, uh oh.\n");
-		return fail;
-	}
-
-	ast_log(LOG_ERROR, "Value for name:'%s', type:'%s', var:'%s', value:'%s'\n\n", name, type, var, ret->child->value.opaque);
-	snprintf(tmp, sizeof(tmp), "%s", ret->child->value.opaque);
-	return tmp;
+	return ret->child->value.opaque;
 }
 
 int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod)




More information about the asterisk-commits mailing list