From: Ulrich Drepper Date: Sun, 14 Mar 2004 20:13:23 +0000 (+0000) Subject: Optimize a bit. It's better to get a reference to the current locale and then use... X-Git-Tag: upstream/2.20~11140 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bc9b83f49805969b7d139b52ef6b003e5136354;p=platform%2Fupstream%2Flinaro-glibc.git Optimize a bit. It's better to get a reference to the current locale and then use the _l functions. --- diff --git a/sysdeps/generic/strcasecmp.c b/sysdeps/generic/strcasecmp.c index aa3a6db..3ae3d67 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 #include -#ifndef weak_alias +#ifndef _LIBC # define __strcasecmp strcasecmp # define TOLOWER(Ch) tolower (Ch) #else +# include # 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; diff --git a/sysdeps/generic/strncase.c b/sysdeps/generic/strncase.c index 4251dc1..a55aaf6 100644 --- a/sysdeps/generic/strncase.c +++ b/sysdeps/generic/strncase.c @@ -1,6 +1,6 @@ /* Compare at most N characters of two strings without taking care for the case. - Copyright (C) 1992, 1996, 1997, 2001 Free Software Foundation, Inc. + Copyright (C) 1992, 1996, 1997, 2001, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,12 +29,11 @@ # define __strncasecmp strncasecmp # define TOLOWER(Ch) tolower (Ch) #else +# include # ifdef USE_IN_EXTENDED_LOCALE_MODEL # define __strncasecmp __strncasecmp_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 @@ -56,6 +55,9 @@ __strncasecmp (s1, s2, n LOCALE_PARAM) size_t n; 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;