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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 22 08:37:35 CDT 2008


Author: eliel
Date: Wed Oct 22 08:37:35 2008
New Revision: 151509

URL: http://svn.digium.com/view/asterisk?view=rev&rev=151509
Log:
Avoid using strlen()s inside the for() conditions.

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=151509&r1=151508&r2=151509
==============================================================================
--- team/group/appdocsxml/main/pbx.c (original)
+++ team/group/appdocsxml/main/pbx.c Wed Oct 22 08:37:35 2008
@@ -3207,7 +3207,7 @@
 {
 	char *tmp, *ret, *t;
 	char *in = (char *)text;
-	int count = 1, tmplen = 0, i, postbrreallen = 0;
+	int count = 1, tmplen = 0, i, postbrreallen = 0, postbrlen;
 	char postbr[160];
 	int sep, needtobreak = 0, colmax;
 
@@ -3233,7 +3233,8 @@
 		if (needtobreak || !(count % colmax)) {
 			if (*in == ' ') {
 				tmp[tmplen++] = '\n';
-				for (i = 0; i < strlen(postbr); i++) {
+				postbrlen = strlen(postbr);
+				for (i = 0; i < postbrlen; i++) {
 					tmp[tmplen++] = postbr[i];
 				}
 				needtobreak = 0;
@@ -3279,7 +3280,8 @@
 					   Sometimes that looks really bad. If needed, we can enable it again
 					   tmp[tmplen++] = '-'; */
 					tmp[tmplen++] = '\n';
-					for (i = 0; i < strlen(postbr); i++) {
+					postbrlen = strlen(postbr);
+					for (i = 0; i < postbrlen; i++) {
 						tmp[tmplen++] = postbr[i];
 					}
 					needtobreak = 0;




More information about the asterisk-commits mailing list