[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-cvs
Subject:    svn commit: r1747424 - /apr/apr/trunk/strings/apr_cstr.c
From:       wrowe () apache ! org
Date:       2016-06-08 17:37:26
Message-ID: 20160608173726.C1AEB3A0287 () svn01-us-west ! apache ! org
[Download RAW message or body]

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;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic