httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r327031 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
Date Thu, 20 Oct 2005 23:07:47 GMT
Author: maxime
Date: Thu Oct 20 16:07:43 2005
New Revision: 327031

URL: http://svn.apache.org/viewcvs?rev=327031&view=rev
Log:
Don't strlen() on each iteration. This could be even more improved, yes.

Modified:
    httpd/mod_mbox/trunk/module-2.0/mod_mbox.c

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox.c?rev=327031&r1=327030&r2=327031&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox.c Thu Oct 20 16:07:43 2005
@@ -148,15 +148,15 @@
 char *mbox_wrap_text(char *str)
 {
     int i, pos;
+    apr_size_t len = strlen(str);
 
-    if (!str ||
-	(strlen(str) < MBOX_WRAP_TO) ||
+    if (!str || (len < MBOX_WRAP_TO) ||
 	/* Don't wrap messages with a size larger than
 	   MBOX_MAX_WRAP */
-	(strlen(str) > MBOX_MAX_WRAP))
+	(len > MBOX_MAX_WRAP))
       return str;
 
-    for (i=0, pos=0; i<strlen(str); i++, pos++) {
+    for (i=0, pos=0; i<len; i++, pos++) {
         /* Reset the position counter if we pass a newline character */
       if (str[i] == '\n') {
 	  pos = 0;



Mime
View raw message