httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1715526 - /httpd/httpd/trunk/server/util.c
Date Sat, 21 Nov 2015 13:57:48 GMT
Author: jim
Date: Sat Nov 21 13:57:48 2015
New Revision: 1715526

URL: http://svn.apache.org/viewvc?rev=1715526&view=rev
Log:
move to simpler while loop and reduce number of returns

Modified:
    httpd/httpd/trunk/server/util.c

Modified: httpd/httpd/trunk/server/util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1715526&r1=1715525&r2=1715526&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util.c (original)
+++ httpd/httpd/trunk/server/util.c Sat Nov 21 13:57:48 2015
@@ -3228,16 +3228,13 @@ AP_DECLARE(int) ap_strncasecmp(const cha
 {
     const unsigned char *ps1 = (const unsigned char *) s1;
     const unsigned char *ps2 = (const unsigned char *) s2;
-    if (n) {
-        do {
-            if (ucharmap[*ps1] != ucharmap[*ps2++]) {
-                return (ucharmap[*ps1] - ucharmap[*--ps2]);
-            }
-            if (*ps1++ == '\0') {
-                /* we know both end here */
-                return (0);
-            }
-        } while (--n != 0);
+    while (n--) {
+        if (ucharmap[*ps1] != ucharmap[*ps2++]) {
+            return (ucharmap[*ps1] - ucharmap[*--ps2]);
+        }
+        if (*ps1++ == '\0') {
+            break;
+        }
     }
     return (0);
 }



Mime
View raw message