[asterisk-commits] eliel: branch group/appdocsxml r138810 - /team/group/appdocsxml/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 19 07:22:35 CDT 2008


Author: eliel
Date: Tue Aug 19 07:22:34 2008
New Revision: 138810

URL: http://svn.digium.com/view/asterisk?view=rev&rev=138810
Log:
Fix a warning message while compiling with --enable-dev-mode.


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=138810&r1=138809&r2=138810
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Tue Aug 19 07:22:34 2008
@@ -3027,22 +3027,21 @@
 
 /*! \internal
  *  \brief Helper function used to build the syntax, it allocates the needed buffer (or reallocates it),
- *         and based on the reverse value it makes use of fmt or fmtrev to print the parameter list inside the 
+ *         and based on the reverse value it makes use of fmt to print the parameter list inside the 
  *         realloced buffer (syntax).
  *  \param reverse We are going backwards while generating the syntax?
  *  \param len Current length of 'syntax' buffer.
  *  \param syntax Output buffer for the concatenated values.
  *  \param fmt A format string that will be used in a sprintf call.
- *  \param fmtrev A format string that will be used in a sprintf call if reverse == 1.
  */
-static void xmldoc_reverse_helper(int reverse, int *len, char **syntax, const char *fmt, const char *fmtrev, ...)
+static __attribute__((format(printf,4,5))) void __xmldoc_reverse_helper(int reverse, int *len, char **syntax, const char *fmt, ...)
 {
 	int totlen, tmpfmtlen;
 	char *tmpfmt, tmp;
 	va_list ap;
 
-	va_start(ap, fmtrev);
-	if (ast_vasprintf(&tmpfmt, (reverse ? fmtrev : fmt), ap) < 0) {
+	va_start(ap, fmt);
+	if (ast_vasprintf(&tmpfmt, fmt, ap) < 0) {
 		va_end(ap);
 		return;
 	}
@@ -3073,6 +3072,13 @@
 	*len = totlen - 1;
 	ast_free(tmpfmt);
 }
+#define xmldoc_reverse_helper(reverse, len, syntax, fmt, fmtrev, ...) do {\
+	if (reverse) { \
+		__xmldoc_reverse_helper(reverse, len, syntax, fmtrev, ##__VA_ARGS__); \
+	} else { \
+		__xmldoc_reverse_helper(reverse, len, syntax, fmt, ##__VA_ARGS__); \
+	} \
+} while (0) \
 
 /*! \internal
  *  \brief Build the syntax for an application or a function.
@@ -3179,7 +3185,11 @@
 	}
 
 	/* init syntax string. */
-	xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", "(", name);
+	if (reverse) {
+		__xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", name);
+	} else {
+		__xmldoc_reverse_helper(reverse, &len, &syntax, ")");
+	}
 
 	while (node) {
 		if (strcasecmp((char *)node->AST_XML_NAME, "parameter")) {
@@ -3247,7 +3257,11 @@
 	}
 
 	/* close syntax string. */
-	xmldoc_reverse_helper(reverse, &len, &syntax, ")", "%s(", name);
+	if (reverse) {
+		__xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", name);
+	} else {
+		__xmldoc_reverse_helper(reverse, &len, &syntax, ")");
+	}
 
 	return syntax;
 #undef ISLAST




More information about the asterisk-commits mailing list