summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2016-06-08 17:37:26 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2016-06-08 17:37:26 +0000
commit634396200a7e0d8592c2a1f947fbb46b97b02a0a (patch)
tree1aca7ff14da9bca6dcfc64ece1ea85029ade77f6 /strings
parenta09e6e370606f636930b0075d3cd27e7cf603205 (diff)
downloadapr-634396200a7e0d8592c2a1f947fbb46b97b02a0a.tar.gz
17% speedup by eliminating redundant eos test
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1747424 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'strings')
-rw-r--r--strings/apr_cstr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/strings/apr_cstr.c b/strings/apr_cstr.c
index 1e0de5af4..6c27702e4 100644
--- a/strings/apr_cstr.c
+++ b/strings/apr_cstr.c
@@ -286,7 +286,8 @@ int apr_cstr_casecmp(const char *str1, const char *str2)
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 char *str2, apr_size_t n)
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;