summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorWilliam A. Rowe Jr <wrowe@apache.org>2016-06-08 22:39:58 +0000
committerWilliam A. Rowe Jr <wrowe@apache.org>2016-06-08 22:39:58 +0000
commit63225f69079607e4b3438c491629435d9256e07b (patch)
treebcbf4fbe941d405f0782ca93c73aed963cb1ede9 /strings
parented26897d2312ed8aebd234b6e47b4319c56dd083 (diff)
downloadapr-63225f69079607e4b3438c491629435d9256e07b.tar.gz
Upon closer scrutiny, the optimization of using short variables
(as opposed to the array of shorts) really didn't hold up. Revert back to processing in 'int' amounts, persist in using short values in the character case folding table, which are more easily retrieved based on word alignment. Aligning and representing the table values as 'int' doesn't exhibit any additional benefit and wastes some DATA page space. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1747461 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'strings')
-rw-r--r--strings/apr_cstr.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/strings/apr_cstr.c b/strings/apr_cstr.c
index a79bf0f61..7c4145109 100644
--- a/strings/apr_cstr.c
+++ b/strings/apr_cstr.c
@@ -279,13 +279,15 @@ static const short ucharmap[] = {
};
#endif
-int apr_cstr_casecmp(const char *str1, const char *str2)
+int apr_cstr_casecmp(const char *s1, const char *s2)
{
+ const unsigned char *str1 = (const unsigned char *)s1;
+ const unsigned char *str2 = (const unsigned char *)s2;
for (;;)
{
- const short c1 = (short)(*((const unsigned char *)str1));
- const short c2 = (short)(*((const unsigned char *)str2));
- const short cmp = ucharmap[c1] - ucharmap[c2];
+ const int c1 = (int)(*str1);
+ const int c2 = (int)(*str2);
+ const int cmp = ucharmap[c1] - ucharmap[c2];
/* Not necessary to test for !c2, this is caught by cmp */
if (cmp || !c1)
return cmp;
@@ -294,13 +296,15 @@ int apr_cstr_casecmp(const char *str1, const char *str2)
}
}
-int apr_cstr_casecmpn(const char *str1, const char *str2, apr_size_t n)
+int apr_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n)
{
+ const unsigned char *str1 = (const unsigned char *)s1;
+ const unsigned char *str2 = (const unsigned char *)s2;
while (n--)
{
- const short c1 = (short)(*((const unsigned char *)str1));
- const short c2 = (short)(*((const unsigned char *)str2));
- const short cmp = ucharmap[c1] - ucharmap[c2];
+ const int c1 = (int)(*str1);
+ const int c2 = (int)(*str2);
+ const int cmp = ucharmap[c1] - ucharmap[c2];
/* Not necessary to test for !c2, this is caught by cmp */
if (cmp || !c1)
return cmp;