diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2016-06-08 17:37:26 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2016-06-08 17:37:26 +0000 |
commit | 634396200a7e0d8592c2a1f947fbb46b97b02a0a (patch) | |
tree | 1aca7ff14da9bca6dcfc64ece1ea85029ade77f6 /strings | |
parent | a09e6e370606f636930b0075d3cd27e7cf603205 (diff) | |
download | apr-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.c | 6 |
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; |