You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2015/11/21 14:57:48 UTC

svn commit: r1715526 - /httpd/httpd/trunk/server/util.c

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);
 }