summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-10-11 02:10:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:46 -0500
commit173ec86fc05666690909a2ffe4721217fb3ceb51 (patch)
treef611238c3095eef5f973b8328a3f42786864159f
parent51009f7052fd6c61d70a35ec311358f962c365c9 (diff)
downloadsamba-173ec86fc05666690909a2ffe4721217fb3ceb51.tar.gz
samba-173ec86fc05666690909a2ffe4721217fb3ceb51.tar.bz2
samba-173ec86fc05666690909a2ffe4721217fb3ceb51.zip
r2902: make toupper_w() and tolower_w() slightly faster by putting the most common
conditions first (This used to be commit 878f6b565f4e80eefbb08f44551b3b4f647d7aa7)
-rw-r--r--source4/lib/util_unistr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/source4/lib/util_unistr.c b/source4/lib/util_unistr.c
index 672c7cd2c8..7d10b92c43 100644
--- a/source4/lib/util_unistr.c
+++ b/source4/lib/util_unistr.c
@@ -54,16 +54,16 @@ static void load_case_tables(void)
********************************************************************/
codepoint_t toupper_w(codepoint_t val)
{
- if (val & 0xFFFF0000) {
- return val;
- }
if (val < 128) {
return toupper(val);
}
+ if (upcase_table == (void *)-1) {
+ return val;
+ }
if (upcase_table == NULL) {
load_case_tables();
}
- if (upcase_table == (void *)-1) {
+ if (val & 0xFFFF0000) {
return val;
}
return SVAL(upcase_table, val*2);
@@ -74,16 +74,16 @@ codepoint_t toupper_w(codepoint_t val)
********************************************************************/
codepoint_t tolower_w(codepoint_t val)
{
- if (val & 0xFFFF0000) {
- return val;
- }
if (val < 128) {
return tolower(val);
}
+ if (lowcase_table == (void *)-1) {
+ return val;
+ }
if (lowcase_table == NULL) {
load_case_tables();
}
- if (lowcase_table == (void *)-1) {
+ if (val & 0xFFFF0000) {
return val;
}
return SVAL(lowcase_table, val*2);