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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 29 09:05:31 CDT 2008


Author: eliel
Date: Mon Sep 29 09:05:31 2008
New Revision: 145175

URL: http://svn.digium.com/view/asterisk?view=rev&rev=145175
Log:
Remove useless code to reduce code complexity

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=145175&r1=145174&r2=145175
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Mon Sep 29 09:05:31 2008
@@ -3198,7 +3198,7 @@
  *  \param syntax Output buffer for the concatenated values.
  *  \param fmt A format string that will be used in a sprintf call.
  */
-static __attribute__((format(printf,4,5))) void __xmldoc_reverse_helper(int reverse, int *len, char **syntax, const char *fmt, ...)
+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;
@@ -3236,13 +3236,6 @@
 	*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 a specified starting node.
@@ -3347,9 +3340,9 @@
 
 	/* init syntax string. */
 	if (reverse) {
-		__xmldoc_reverse_helper(reverse, &len, &syntax, ")");
+		xmldoc_reverse_helper(reverse, &len, &syntax, ")");
 	} else {
-		__xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", rootname);
+		xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", rootname);
 	}
 
 	while (node) {
@@ -3383,34 +3376,34 @@
 		if (required) {
 			/* First parameter */
 			if (!paramcount) {
-				xmldoc_reverse_helper(reverse, &len, &syntax, "%s", "%s", paramname);
+				xmldoc_reverse_helper(reverse, &len, &syntax, "%s", paramname);
 			} else {
 				while (openbrackets > 0) {
-					xmldoc_reverse_helper(reverse, &len, &syntax, "]", "[");
+					xmldoc_reverse_helper(reverse, &len, &syntax, (reverse ? "[" : "]"));
 					openbrackets--;
 				}
 				if (reverse) {
-					__xmldoc_reverse_helper(reverse, &len, &syntax, "%s%s", paramname, argsep);
+					xmldoc_reverse_helper(reverse, &len, &syntax, "%s%s", paramname, argsep);
 				} else {
-					__xmldoc_reverse_helper(reverse, &len, &syntax, "%s%s", argsep, paramname);
+					xmldoc_reverse_helper(reverse, &len, &syntax, "%s%s", argsep, paramname);
 				}
 			}
 		} else {
 			/* First parameter */
 			if (!paramcount) {
-				xmldoc_reverse_helper(reverse, &len, &syntax, "[%s]", "[%s]", paramname);
+				xmldoc_reverse_helper(reverse, &len, &syntax, "[%s]", paramname);
 			} else {
 				if (ISLAST(reverse, node)) {
 					if (reverse) {
-						__xmldoc_reverse_helper(reverse, &len, &syntax, "[%s]%s", paramname, argsep);
+						xmldoc_reverse_helper(reverse, &len, &syntax, "[%s]%s", paramname, argsep);
 					} else {
-						__xmldoc_reverse_helper(reverse, &len, &syntax, "%s[%s]", argsep, paramname);
+						xmldoc_reverse_helper(reverse, &len, &syntax, "%s[%s]", argsep, paramname);
 					}
 				} else {
 					if (reverse) {
-						__xmldoc_reverse_helper(reverse, &len, &syntax, "%s%s]", paramname, argsep);
+						xmldoc_reverse_helper(reverse, &len, &syntax, "%s%s]", paramname, argsep);
 					} else {
-						__xmldoc_reverse_helper(reverse, &len, &syntax, "[%s%s", argsep, paramname);
+						xmldoc_reverse_helper(reverse, &len, &syntax, "[%s%s", argsep, paramname);
 					}
 					openbrackets++;
 				}
@@ -3424,15 +3417,15 @@
 	}
 
 	while (openbrackets > 0) {
-		xmldoc_reverse_helper(reverse, &len, &syntax, "]", "[");
+		xmldoc_reverse_helper(reverse, &len, &syntax, (reverse ? "[" : "]"));
 		openbrackets--;
 	}
 
 	/* close syntax string. */
 	if (reverse) {
-		__xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", rootname);
+		xmldoc_reverse_helper(reverse, &len, &syntax, "%s(", rootname);
 	} else {
-		__xmldoc_reverse_helper(reverse, &len, &syntax, ")");
+		xmldoc_reverse_helper(reverse, &len, &syntax, ")");
 	}
 
 	return syntax;




More information about the asterisk-commits mailing list