summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/strcoll.c
diff options
context:
space:
mode:
authordt <dt@FreeBSD.org>1999-09-12 21:15:28 +0000
committerdt <dt@FreeBSD.org>1999-09-12 21:15:28 +0000
commitb96c3bcd66f43d6176a9d5dff69d9f5aeb697a62 (patch)
treec72753af6cb6e86b7dcd2aef040ec986a7ca8d82 /lib/libc/string/strcoll.c
parent12c22f65a5bb7ee59be3065b48b191434c23cc08 (diff)
downloadFreeBSD-src-b96c3bcd66f43d6176a9d5dff69d9f5aeb697a62.zip
FreeBSD-src-b96c3bcd66f43d6176a9d5dff69d9f5aeb697a62.tar.gz
__collate_substitute() do something non-trivial only for German. For everyone
else, it is equivalent to strdup(). So, we will check if the substitution tables are trivial at the load time, and possibly save 2 calls to __collate_substitute() in strcoll(). Still, __collate_substitute() should not exist.
Diffstat (limited to 'lib/libc/string/strcoll.c')
-rw-r--r--lib/libc/string/strcoll.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c
index b4631a1..5213cf8 100644
--- a/lib/libc/string/strcoll.c
+++ b/lib/libc/string/strcoll.c
@@ -36,15 +36,22 @@ strcoll(s, s2)
const char *s, *s2;
{
int len, len2, prim, prim2, sec, sec2, ret, ret2;
- char *tt, *t, *tt2, *t2;
+ const char *t, *t2;
+ char *tt, *tt2;
if (__collate_load_error)
return strcmp(s, s2);
len = len2 = 1;
ret = ret2 = 0;
- tt = t = __collate_substitute(s);
- tt2 = t2 = __collate_substitute(s2);
+ if (__collate_substitute_nontrivial) {
+ t = tt = __collate_substitute(s);
+ t2 = tt2 = __collate_substitute(s2);
+ } else {
+ tt = tt2 = NULL;
+ t = s;
+ t2 = s2;
+ }
while(*t && *t2) {
prim = prim2 = 0;
while(*t && !prim) {
OpenPOWER on IntegriCloud