From e755fb76719b65d75022a66322432a59fc36b00f Mon Sep 17 00:00:00 2001
From: Dmitrij Tejblum
Date: Sun, 12 Sep 1999 21:15:28 +0000
Subject: __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.
---
lib/libc/string/strcoll.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
(limited to 'lib/libc/string/strcoll.c')
diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c
index b4631a1f00ad..5213cf84d978 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) {
--
cgit v1.2.3