You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2016/06/08 17:37:26 UTC

svn commit: r1747424 - /apr/apr/trunk/strings/apr_cstr.c

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;