apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject svn commit: r1747424 - /apr/apr/trunk/strings/apr_cstr.c
Date Wed, 08 Jun 2016 17:37:26 GMT
Author: wrowe
Date: Wed Jun  8 17:37:26 2016
New Revision: 1747424

URL: http://svn.apache.org/viewvc?rev=1747424&view=rev
Log:
17% speedup by eliminating redundant eos test

Modified:
    apr/apr/trunk/strings/apr_cstr.c

Modified: apr/apr/trunk/strings/apr_cstr.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/strings/apr_cstr.c?rev=1747424&r1=1747423&r2=1747424&view=diff
==============================================================================
--- apr/apr/trunk/strings/apr_cstr.c (original)
+++ apr/apr/trunk/strings/apr_cstr.c Wed Jun  8 17:37:26 2016
@@ -286,7 +286,8 @@ int apr_cstr_casecmp(const char *str1, c
         const int c1 = (int)(*((const unsigned char *)str1++));
         const int c2 = (int)(*((const unsigned char *)str2++));
         const int cmp = ucharmap[c1] - ucharmap[c2];
-        if (cmp || !c1 || !c2)
+        /* Not necessary to test for !c2, this is caught by cmp */
+        if (cmp || !c1)
             return cmp;
     }
 }
@@ -298,7 +299,8 @@ int apr_cstr_casecmpn(const char *str1,
         const int c1 = (int)(*((const unsigned char *)str1++));
         const int c2 = (int)(*((const unsigned char *)str2++));
         const int cmp = ucharmap[c1] - ucharmap[c2];
-        if (cmp || !c1 || !c2)
+        /* Not necessary to test for !c2, this is caught by cmp */
+        if (cmp || !c1)
             return cmp;
     }
     return 0;



Mime
View raw message