summaryrefslogtreecommitdiff
path: root/source3/lib/util_str.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-01-09 17:32:26 -0800
committerJeremy Allison <jra@samba.org>2008-01-09 17:32:26 -0800
commit980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8 (patch)
tree1346ffda48fd6f92daeac194eb84bba3e631a983 /source3/lib/util_str.c
parent253fbf1a6ece5c8dc9759e3535b7f9fa46883c1b (diff)
downloadsamba-980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8.tar.gz
samba-980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8.tar.bz2
samba-980ac0984905d8c3f29dd62ed75fc9c7cb22cdd8.zip
Fixup hot paths - add macro for toupper (c < 0x80).
This now matches 3.0.x on my micro-tests. Jeremy. (This used to be commit 329b924cba8225002ca40db26c45b31d141a0925)
Diffstat (limited to 'source3/lib/util_str.c')
-rw-r--r--source3/lib/util_str.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c
index 7e21fe1195..3e3268104c 100644
--- a/source3/lib/util_str.c
+++ b/source3/lib/util_str.c
@@ -24,6 +24,17 @@
#include "includes.h"
+char toupper_ascii_fast_table[128] = {
+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f
+};
+
/**
* @file
* @brief String utilities.
@@ -187,8 +198,8 @@ int StrCaseCmp(const char *s, const char *t)
* from here on in */
break;
- us = toupper_ascii(*ps);
- ut = toupper_ascii(*pt);
+ us = toupper_ascii_fast(*ps);
+ ut = toupper_ascii_fast(*pt);
if (us == ut)
continue;
else if (us < ut)
@@ -246,8 +257,8 @@ int StrnCaseCmp(const char *s, const char *t, size_t len)
* hard way from here on in */
break;
- us = toupper_ascii(*ps);
- ut = toupper_ascii(*pt);
+ us = toupper_ascii_fast(*ps);
+ ut = toupper_ascii_fast(*pt);
if (us == ut)
continue;
else if (us < ut)
@@ -1679,7 +1690,7 @@ void strupper_m(char *s)
(ie. they match for the first 128 chars) */
while (*s && !(((unsigned char)s[0]) & 0x80)) {
- *s = toupper_ascii((unsigned char)*s);
+ *s = toupper_ascii_fast((unsigned char)*s);
s++;
}