summaryrefslogtreecommitdiff
path: root/sysdeps/generic/strcasecmp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-03-14 20:13:23 +0000
committerUlrich Drepper <drepper@redhat.com>2004-03-14 20:13:23 +0000
commit3bc9b83f49805969b7d139b52ef6b003e5136354 (patch)
tree69d396ce5ffc4776494181985a6029080308b3f6 /sysdeps/generic/strcasecmp.c
parentfd1886a1683fd5966337f8d238822077775947db (diff)
Optimize a bit. It's better to get a reference to the current locale and then use the _l functions.
Diffstat (limited to 'sysdeps/generic/strcasecmp.c')
-rw-r--r--sysdeps/generic/strcasecmp.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sysdeps/generic/strcasecmp.c b/sysdeps/generic/strcasecmp.c
index aa3a6db551..3ae3d67d04 100644
--- a/sysdeps/generic/strcasecmp.c
+++ b/sysdeps/generic/strcasecmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,1992,1995,1996,1997,2001,2002
+/* Copyright (C) 1991,1992,1995,1996,1997,2001,2002, 2004
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,16 +24,15 @@
#include <ctype.h>
#include <string.h>
-#ifndef weak_alias
+#ifndef _LIBC
# define __strcasecmp strcasecmp
# define TOLOWER(Ch) tolower (Ch)
#else
+# include <locale/localeinfo.h>
# ifdef USE_IN_EXTENDED_LOCALE_MODEL
# define __strcasecmp __strcasecmp_l
-# define TOLOWER(Ch) __tolower_l ((Ch), loc)
-# else
-# define TOLOWER(Ch) tolower (Ch)
# endif
+# define TOLOWER(Ch) __tolower_l ((Ch), loc)
#endif
#ifdef USE_IN_EXTENDED_LOCALE_MODEL
@@ -53,6 +52,9 @@ __strcasecmp (s1, s2 LOCALE_PARAM)
const char *s2;
LOCALE_PARAM_DECL
{
+#if defined _LIBC && !defined USE_IN_EXTENDED_LOCALE_MODEL
+ __locale_t loc = _NL_CURRENT_LOCALE;
+#endif
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
int result;