All pastes #1474018 Raw Edit

Miscellany

public diff v1 · immutable
#1474018 ·published 2009-06-25 09:02 UTC
rendered paste body
Index: main/xmldoc.c===================================================================--- main/xmldoc.c	(revision 202567)+++ main/xmldoc.c	(working copy)@@ -1835,7 +1835,7 @@ 	struct ast_xml_node *root_node; 	struct ast_xml_doc *tmpdoc; 	struct documentation_tree *doc_tree;-	char *xmlpattern;+	char xmlpattern[512]; 	struct ast_config *cfg = NULL; 	struct ast_variable *var = NULL; 	struct ast_flags cnfflags = { 0 };@@ -1862,21 +1862,40 @@ 	/* register function to be run when asterisk finish. */ 	ast_register_atexit(xmldoc_unload_documentation); -	/* Get every *-LANG.xml file inside $(ASTDATADIR)/documentation */-	ast_asprintf(&xmlpattern, "%s/documentation{/thirdparty/,/}*-{%s,%.2s_??,%s}.xml", ast_config_AST_DATA_DIR,-			documentation_language, documentation_language, default_documentation_language); 	globbuf.gl_offs = 0;    /* initialize it to silence gcc */+	+	snprintf(xmlpattern, sizeof(xmlpattern), "%s/documentation/thirdparty/*-%s.xml", +			ast_config_AST_DATA_DIR, documentation_language); 	globret = glob(xmlpattern, MY_GLOB_FLAGS, NULL, &globbuf);+	snprintf(xmlpattern, sizeof(xmlpattern),"%s/documentation/*-%s.xml", +			ast_config_AST_DATA_DIR, documentation_language);+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);+	snprintf(xmlpattern, sizeof(xmlpattern), "%s/documentation/*-%.2s_??.xml", +			ast_config_AST_DATA_DIR, documentation_language);+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);+	snprintf(xmlpattern, sizeof(xmlpattern), "%s/documentation/*-%s.xml", +			ast_config_AST_DATA_DIR, default_documentation_language);+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);+	snprintf(xmlpattern, sizeof(xmlpattern), "%s/documentation/thirdparty/*-%s.xml", +			ast_config_AST_DATA_DIR, documentation_language);+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);+	snprintf(xmlpattern, sizeof(xmlpattern), "%s/documentation/thirdparty/*-%.2s_??.xml", +			ast_config_AST_DATA_DIR, documentation_language);+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);+	snprintf(xmlpattern, sizeof(xmlpattern), "%s/documentation/thirdparty/*-%s.xml", +			ast_config_AST_DATA_DIR, default_documentation_language);+	globret = glob(xmlpattern, MY_GLOB_FLAGS | GLOB_APPEND, NULL, &globbuf);++	/* Get every *-LANG.xml file inside $(ASTDATADIR)/documentation */+	//ast_asprintf(&xmlpattern, "%s/documentation{/thirdparty/,/}*-{%s,%.2s_??,%s}.xml", ast_config_AST_DATA_DIR,+	//		documentation_language, documentation_language, default_documentation_language); 	if (globret == GLOB_NOSPACE) { 		ast_log(LOG_WARNING, "Glob Expansion of pattern '%s' failed: Not enough memory\n", xmlpattern);-		ast_free(xmlpattern); 		return 1; 	} else if (globret  == GLOB_ABORTED) { 		ast_log(LOG_WARNING, "Glob Expansion of pattern '%s' failed: Read error\n", xmlpattern);-		ast_free(xmlpattern); 		return 1; 	}-	ast_free(xmlpattern);  	AST_RWLIST_WRLOCK(&xmldoc_tree); 	/* loop over expanded files */