summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2016-06-08 22:39:58 +0000
committerwrowe <wrowe@13f79535-47bb-0310-9956-ffa450edef68>2016-06-08 22:39:58 +0000
commitfcd5caeedc45b7295cc570a0880dfdec783a04e0 (patch)
treebcbf4fbe941d405f0782ca93c73aed963cb1ede9 /strings
parent2d06e864119382b18186ad4902439b0bc043123e (diff)
downloadlibapr-fcd5caeedc45b7295cc570a0880dfdec783a04e0.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: http://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;