mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
* ctype/ctype.h (__ctype_b, __ctype_toupper, __ctype_tolower):
Variable declarations removed. (__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Declare these functions to replace them. (__isctype, tolower, toupper, _tolower, _toupper): Use those accessor functions plus an indirection rather than the old global variables. * include/ctype.h (__isctype, tolower, _tolower, toupper, _toupper): Macros removed. (__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): New extern inline functions. * ctype/ctype-info.c: Revert last reversion back the other way. Define tsd vars CTYPE_B, CTYPE_TOLOWER, CTYPE_TOUPPER. Define real function versions of include/ctype.h inlines here. * ctype/Versions (libc: GLIBC_2.3): Add __ctype_b_loc, __ctype_tolower_loc, __ctype_toupper_loc. * locale/lc-ctype.c: Revert last reversion back the other way. (_nl_postload_ctype): If current thread uses the global locale, update its tsd vars. * locale/uselocale.c (__uselocale): Update tsd vars from new locale. * hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add CTYPE_B, CTYPE_TOLOWER, CTYPE_TOUPPER. * sysdeps/generic/bits/libc-tsd.h (__libc_tsd_address): New macro. * sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_address): Renamed from __libc_tsd_threadvar_location. (__libc_tsd_set, __libc_tsd_get): Update uses.
This commit is contained in:
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
|||||||
|
2002-09-01 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
|
* ctype/ctype.h (__ctype_b, __ctype_toupper, __ctype_tolower):
|
||||||
|
Variable declarations removed.
|
||||||
|
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): Declare
|
||||||
|
these functions to replace them.
|
||||||
|
(__isctype, tolower, toupper, _tolower, _toupper): Use those accessor
|
||||||
|
functions plus an indirection rather than the old global variables.
|
||||||
|
* include/ctype.h (__isctype, tolower, _tolower, toupper, _toupper):
|
||||||
|
Macros removed.
|
||||||
|
(__ctype_b_loc, __ctype_toupper_loc, __ctype_tolower_loc): New extern
|
||||||
|
inline functions.
|
||||||
|
* ctype/ctype-info.c: Revert last reversion back the other way.
|
||||||
|
Define tsd vars CTYPE_B, CTYPE_TOLOWER, CTYPE_TOUPPER.
|
||||||
|
Define real function versions of include/ctype.h inlines here.
|
||||||
|
* ctype/Versions (libc: GLIBC_2.3): Add __ctype_b_loc,
|
||||||
|
__ctype_tolower_loc, __ctype_toupper_loc.
|
||||||
|
* locale/lc-ctype.c: Revert last reversion back the other way.
|
||||||
|
(_nl_postload_ctype): If current thread uses the global locale,
|
||||||
|
update its tsd vars.
|
||||||
|
* locale/uselocale.c (__uselocale): Update tsd vars from new locale.
|
||||||
|
* hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add CTYPE_B,
|
||||||
|
CTYPE_TOLOWER, CTYPE_TOUPPER.
|
||||||
|
|
||||||
|
* sysdeps/generic/bits/libc-tsd.h (__libc_tsd_address): New macro.
|
||||||
|
* sysdeps/mach/hurd/bits/libc-tsd.h (__libc_tsd_address): Renamed
|
||||||
|
from __libc_tsd_threadvar_location.
|
||||||
|
(__libc_tsd_set, __libc_tsd_get): Update uses.
|
||||||
|
|
||||||
2002-09-01 Ulrich Drepper <drepper@redhat.com>
|
2002-09-01 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* ctype/ctype.h: Undo the patch before the last one. Put back the
|
* ctype/ctype.h: Undo the patch before the last one. Put back the
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
keys used in only one source file,
|
keys used in only one source file,
|
||||||
empty for global definitions, or
|
empty for global definitions, or
|
||||||
`extern' for global declarations.
|
`extern' for global declarations.
|
||||||
|
__libc_tsd_address(KEY) -- Return the `void **' pointing to
|
||||||
|
the current thread's datum for KEY.
|
||||||
__libc_tsd_get(KEY) -- Return the `void *' datum for KEY.
|
__libc_tsd_get(KEY) -- Return the `void *' datum for KEY.
|
||||||
__libc_tsd_set(KEY, VALUE) -- Set the datum for KEY to VALUE.
|
__libc_tsd_set(KEY, VALUE) -- Set the datum for KEY to VALUE.
|
||||||
|
|
||||||
@ -52,11 +54,13 @@
|
|||||||
#if USE_TLS && HAVE___THREAD
|
#if USE_TLS && HAVE___THREAD
|
||||||
# define __libc_tsd_define(CLASS, KEY) CLASS __thread void *__libc_tsd_##KEY;
|
# define __libc_tsd_define(CLASS, KEY) CLASS __thread void *__libc_tsd_##KEY;
|
||||||
|
|
||||||
|
# define __libc_tsd_address(KEY) (&__libc_tsd_##KEY)
|
||||||
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY)
|
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY)
|
||||||
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
|
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
|
||||||
#else
|
#else
|
||||||
# define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
# define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
||||||
|
|
||||||
|
# define __libc_tsd_address(KEY) (&__libc_tsd_##KEY)
|
||||||
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY##_data)
|
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY##_data)
|
||||||
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY##_data = (VALUE))
|
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY##_data = (VALUE))
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,5 +17,8 @@ libc {
|
|||||||
}
|
}
|
||||||
GLIBC_2.3 {
|
GLIBC_2.3 {
|
||||||
isctype; __isctype;
|
isctype; __isctype;
|
||||||
|
|
||||||
|
# functions used by optimized macros in ctype.h
|
||||||
|
__ctype_b_loc; __ctype_tolower_loc; __ctype_toupper_loc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991,92,95,96,97,99,2000,2002 Free Software Foundation, Inc.
|
/* Copyright (C) 1991,92,95,96,97,99,2000,02 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -16,9 +16,18 @@
|
|||||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
|
#define CTYPE_EXTERN_INLINE /* Define real functions for accessors. */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <locale/localeinfo.h>
|
#include <locale/localeinfo.h>
|
||||||
|
|
||||||
|
__libc_tsd_define (, CTYPE_B)
|
||||||
|
__libc_tsd_define (, CTYPE_TOLOWER)
|
||||||
|
__libc_tsd_define (, CTYPE_TOUPPER)
|
||||||
|
|
||||||
|
|
||||||
|
#include <shlib-compat.h>
|
||||||
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
||||||
|
|
||||||
/* Defined in locale/C-ctype.c. */
|
/* Defined in locale/C-ctype.c. */
|
||||||
extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
|
extern const char _nl_C_LC_CTYPE_class[] attribute_hidden;
|
||||||
extern const char _nl_C_LC_CTYPE_class32[] attribute_hidden;
|
extern const char _nl_C_LC_CTYPE_class32[] attribute_hidden;
|
||||||
@ -36,36 +45,21 @@ extern const char _nl_C_LC_CTYPE_class_blank[] attribute_hidden;
|
|||||||
extern const char _nl_C_LC_CTYPE_class_cntrl[] attribute_hidden;
|
extern const char _nl_C_LC_CTYPE_class_cntrl[] attribute_hidden;
|
||||||
extern const char _nl_C_LC_CTYPE_class_punct[] attribute_hidden;
|
extern const char _nl_C_LC_CTYPE_class_punct[] attribute_hidden;
|
||||||
extern const char _nl_C_LC_CTYPE_class_alnum[] attribute_hidden;
|
extern const char _nl_C_LC_CTYPE_class_alnum[] attribute_hidden;
|
||||||
extern const char _nl_C_LC_CTYPE_map_toupper[] attribute_hidden;
|
|
||||||
extern const char _nl_C_LC_CTYPE_map_tolower[] attribute_hidden;
|
|
||||||
extern const char _nl_C_LC_CTYPE_width[] attribute_hidden;
|
|
||||||
|
|
||||||
#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o)
|
#define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o)
|
||||||
|
|
||||||
const unsigned short int *__ctype_b = b (unsigned short int, class, 128);
|
const unsigned short int *__ctype_old_b = b (unsigned short int, class, 128);
|
||||||
const __uint32_t *__ctype32_b = b (__uint32_t, class32, 0);
|
const __uint32_t *__ctype32_old_b = b (__uint32_t, class32, 0);
|
||||||
const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128);
|
const __int32_t *__ctype_old_tolower = b (__int32_t, tolower, 128);
|
||||||
const __int32_t *__ctype_toupper = b (__int32_t, toupper, 128);
|
const __int32_t *__ctype_old_toupper = b (__int32_t, toupper, 128);
|
||||||
const __uint32_t *__ctype32_tolower = b (__uint32_t, tolower, 128);
|
const __uint32_t *__ctype32_old_tolower = b (__uint32_t, tolower, 128);
|
||||||
const __uint32_t *__ctype32_toupper = b (__uint32_t, toupper, 128);
|
const __uint32_t *__ctype32_old_toupper = b (__uint32_t, toupper, 128);
|
||||||
const char *__ctype32_wctype[12] attribute_hidden =
|
|
||||||
{
|
compat_symbol (libc, __ctype_old_b, __ctype_b, GLIBC_2_0);
|
||||||
b(char, class_upper, 32),
|
compat_symbol (libc, __ctype_old_tolower, __ctype_tolower, GLIBC_2_0);
|
||||||
b(char, class_lower, 32),
|
compat_symbol (libc, __ctype_old_toupper, __ctype_toupper, GLIBC_2_0);
|
||||||
b(char, class_alpha, 32),
|
compat_symbol (libc, __ctype32_old_b, __ctype32_b, GLIBC_2_0);
|
||||||
b(char, class_digit, 32),
|
compat_symbol (libc, __ctype32_old_tolower, __ctype32_tolower, GLIBC_2_2);
|
||||||
b(char, class_xdigit, 32),
|
compat_symbol (libc, __ctype32_old_toupper, __ctype32_toupper, GLIBC_2_2);
|
||||||
b(char, class_space, 32),
|
|
||||||
b(char, class_print, 32),
|
#endif
|
||||||
b(char, class_graph, 32),
|
|
||||||
b(char, class_blank, 32),
|
|
||||||
b(char, class_cntrl, 32),
|
|
||||||
b(char, class_punct, 32),
|
|
||||||
b(char, class_alnum, 32)
|
|
||||||
};
|
|
||||||
const char *__ctype32_wctrans[2] attribute_hidden =
|
|
||||||
{
|
|
||||||
b(char, map_toupper, 0),
|
|
||||||
b(char, map_tolower, 0)
|
|
||||||
};
|
|
||||||
const char *__ctype32_width attribute_hidden = b (char, width, 0);
|
|
||||||
|
@ -65,6 +65,11 @@ enum
|
|||||||
/* These are defined in ctype-info.c.
|
/* These are defined in ctype-info.c.
|
||||||
The declarations here must match those in localeinfo.h.
|
The declarations here must match those in localeinfo.h.
|
||||||
|
|
||||||
|
In the thread-specific locale model (see `uselocale' in <locale.h>)
|
||||||
|
we cannot use global variables for these as was done in the past.
|
||||||
|
Instead, the following accessor functions return the address of
|
||||||
|
each variable, which is local to the current thread if multithreaded.
|
||||||
|
|
||||||
These point into arrays of 384, so they can be indexed by any `unsigned
|
These point into arrays of 384, so they can be indexed by any `unsigned
|
||||||
char' value [0,255]; by EOF (-1); or by any `signed char' value
|
char' value [0,255]; by EOF (-1); or by any `signed char' value
|
||||||
[-128,-1). ISO C requires that the ctype functions work for `unsigned
|
[-128,-1). ISO C requires that the ctype functions work for `unsigned
|
||||||
@ -73,12 +78,15 @@ enum
|
|||||||
rather than `unsigned char's because tolower (EOF) must be EOF, which
|
rather than `unsigned char's because tolower (EOF) must be EOF, which
|
||||||
doesn't fit into an `unsigned char'. But today more important is that
|
doesn't fit into an `unsigned char'. But today more important is that
|
||||||
the arrays are also used for multi-byte character sets. */
|
the arrays are also used for multi-byte character sets. */
|
||||||
extern __const unsigned short int *__ctype_b; /* Characteristics. */
|
extern __const unsigned short int **__ctype_b_loc (void)
|
||||||
extern __const __int32_t *__ctype_tolower; /* Case conversions. */
|
__attribute__ ((__const));
|
||||||
extern __const __int32_t *__ctype_toupper; /* Case conversions. */
|
extern __const __int32_t **__ctype_tolower_loc (void)
|
||||||
|
__attribute__ ((__const));
|
||||||
|
extern __const __int32_t **__ctype_toupper_loc (void)
|
||||||
|
__attribute__ ((__const));
|
||||||
|
|
||||||
#define __isctype(c, type) \
|
#define __isctype(c, type) \
|
||||||
(__ctype_b[(int) (c)] & (unsigned short int) type)
|
((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type)
|
||||||
|
|
||||||
#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */
|
#define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */
|
||||||
#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */
|
#define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */
|
||||||
@ -182,27 +190,27 @@ __exctype (_tolower);
|
|||||||
extern __inline int
|
extern __inline int
|
||||||
tolower (int __c) __THROW
|
tolower (int __c) __THROW
|
||||||
{
|
{
|
||||||
return __c >= -128 && __c < 256 ? __ctype_tolower[__c] : __c;
|
return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern __inline int
|
extern __inline int
|
||||||
toupper (int __c) __THROW
|
toupper (int __c) __THROW
|
||||||
{
|
{
|
||||||
return __c >= -128 && __c < 256 ? __ctype_toupper[__c] : __c;
|
return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
|
# if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus
|
||||||
# define tolower(c) __tobody (c, tolower, __ctype_tolower, (c))
|
# define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c))
|
||||||
# define toupper(c) __tobody (c, toupper, __ctype_toupper, (c))
|
# define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c))
|
||||||
# endif /* Optimizing gcc */
|
# endif /* Optimizing gcc */
|
||||||
|
|
||||||
# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
|
# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN
|
||||||
# define isascii(c) __isascii (c)
|
# define isascii(c) __isascii (c)
|
||||||
# define toascii(c) __toascii (c)
|
# define toascii(c) __toascii (c)
|
||||||
|
|
||||||
# define _tolower(c) ((int) __ctype_tolower[(int) (c)])
|
# define _tolower(c) ((int) (*__ctype_tolower_loc ())[(int) (c)])
|
||||||
# define _toupper(c) ((int) __ctype_toupper[(int) (c)])
|
# define _toupper(c) ((int) (*__ctype_toupper_loc ())[(int) (c)])
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif /* Not __NO_CTYPE. */
|
#endif /* Not __NO_CTYPE. */
|
||||||
|
@ -65,7 +65,10 @@ enum __hurd_threadvar_index
|
|||||||
_HURD_THREADVAR_MALLOC, /* For use of malloc. */
|
_HURD_THREADVAR_MALLOC, /* For use of malloc. */
|
||||||
_HURD_THREADVAR_DL_ERROR, /* For use of -ldl and dynamic linker. */
|
_HURD_THREADVAR_DL_ERROR, /* For use of -ldl and dynamic linker. */
|
||||||
_HURD_THREADVAR_RPC_VARS, /* For state of RPC functions. */
|
_HURD_THREADVAR_RPC_VARS, /* For state of RPC functions. */
|
||||||
_HURD_THREADVAR_LOCALE, /* For thread-locale locale setting. */
|
_HURD_THREADVAR_LOCALE, /* For thread-local locale setting. */
|
||||||
|
_HURD_THREADVAR_CTYPE_B, /* Cache of thread-local locale data. */
|
||||||
|
_HURD_THREADVAR_CTYPE_TOLOWER, /* Cache of thread-local locale data. */
|
||||||
|
_HURD_THREADVAR_CTYPE_TOUPPER, /* Cache of thread-local locale data. */
|
||||||
_HURD_THREADVAR_MAX /* Default value for __hurd_threadvar_max. */
|
_HURD_THREADVAR_MAX /* Default value for __hurd_threadvar_max. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,39 +2,58 @@
|
|||||||
|
|
||||||
extern int __isctype (int __c, int __mask);
|
extern int __isctype (int __c, int __mask);
|
||||||
|
|
||||||
# include <ctype/ctype.h>
|
|
||||||
|
|
||||||
# ifndef NOT_IN_libc
|
# ifndef NOT_IN_libc
|
||||||
|
|
||||||
/* The optimized macros are not defined for users because they can't see
|
/* These accessors are used by the optimized macros to find the
|
||||||
the thread-local locale state. For inside libc, define them using the
|
thread-local cache of ctype information from the current thread's
|
||||||
_NL_CURRENT accessors. We don't use _NL_CURRENT_LOCALE->__ctype_b here
|
locale. For inside libc, define them as inlines using the _NL_CURRENT
|
||||||
because we want to cause a link-time ref to _nl_current_LC_CTYPE under
|
accessors. We don't use _NL_CURRENT_LOCALE->__ctype_b here because we
|
||||||
|
want to cause a link-time ref to _nl_current_LC_CTYPE under
|
||||||
NL_CURRENT_INDIRECT. */
|
NL_CURRENT_INDIRECT. */
|
||||||
|
|
||||||
# include "../locale/localeinfo.h"
|
# include "../locale/localeinfo.h"
|
||||||
# ifndef __NO_CTYPE
|
# include <bits/libc-tsd.h>
|
||||||
# undef __isctype
|
|
||||||
# define __isctype(c, type) \
|
|
||||||
(((uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128) \
|
|
||||||
[(int) (c)] & (uint16_t) type)
|
|
||||||
|
|
||||||
# undef tolower
|
# ifndef CTYPE_EXTERN_INLINE /* Used by ctype/ctype-info.c, which see. */
|
||||||
# define tolower(c) \
|
# define CTYPE_EXTERN_INLINE extern inline
|
||||||
__tobody (c, tolower, \
|
# endif
|
||||||
(uint32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128, \
|
|
||||||
(c))
|
|
||||||
# undef _tolower
|
|
||||||
# define _tolower(c) tolower (c)
|
|
||||||
# undef toupper
|
|
||||||
# define toupper(c) \
|
|
||||||
__tobody (c, toupper, \
|
|
||||||
(uint32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128, \
|
|
||||||
(c))
|
|
||||||
# undef _toupper
|
|
||||||
# define _toupper(c) toupper (c)
|
|
||||||
|
|
||||||
# endif /* Not __NO_CTYPE. */
|
__libc_tsd_define (extern, CTYPE_B)
|
||||||
# endif /* _LIBC_REENTRANT. */
|
__libc_tsd_define (extern, CTYPE_TOUPPER)
|
||||||
|
__libc_tsd_define (extern, CTYPE_TOLOWER)
|
||||||
|
|
||||||
|
CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
|
||||||
|
__ctype_b_loc (void)
|
||||||
|
{
|
||||||
|
const uint16_t **tablep =
|
||||||
|
(const uint16_t **) __libc_tsd_address (CTYPE_B);
|
||||||
|
if (__builtin_expect (*tablep == NULL, 0))
|
||||||
|
*tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
|
||||||
|
return tablep;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
|
||||||
|
__ctype_toupper_loc (void)
|
||||||
|
{
|
||||||
|
const int32_t **tablep =
|
||||||
|
(const int32_t **) __libc_tsd_address (CTYPE_TOUPPER);
|
||||||
|
if (__builtin_expect (*tablep == NULL, 0))
|
||||||
|
*tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128);
|
||||||
|
return tablep;
|
||||||
|
}
|
||||||
|
|
||||||
|
CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
|
||||||
|
__ctype_tolower_loc (void)
|
||||||
|
{
|
||||||
|
const int32_t **tablep =
|
||||||
|
(const int32_t **) __libc_tsd_address (CTYPE_TOLOWER);
|
||||||
|
if (__builtin_expect (*tablep == NULL, 0))
|
||||||
|
*tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
|
||||||
|
return tablep;
|
||||||
|
}
|
||||||
|
|
||||||
|
# endif /* Not NOT_IN_libc. */
|
||||||
|
|
||||||
|
# include <ctype/ctype.h>
|
||||||
|
|
||||||
#endif /* ctype.h */
|
#endif /* ctype.h */
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
2002-09-01 Roland McGrath <roland@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/pthread/bits/libc-tsd.h (enum __libc_tsd_key_t): Add new keys
|
||||||
|
CTYPE_B, CTYPE_TOLOWER, CTYPE_TOUPPER.
|
||||||
|
|
||||||
|
* sysdeps/pthread/bits/libc-tsd.h (__libc_tsd_address): New macro.
|
||||||
|
(__libc_internal_tsd_address): Declare it.
|
||||||
|
* Versions (libc, ld, libpthread: GLIBC_PRIVATE): Add
|
||||||
|
__libc_internal_tsd_address.
|
||||||
|
* specific.c (libc_internal_tsd_address): New function.
|
||||||
|
(__libc_internal_tsd_address): New variable.
|
||||||
|
* no-tsd.c (__libc_internal_tsd_address): New variable.
|
||||||
|
|
||||||
2002-08-31 Ulrich Drepper <drepper@redhat.com>
|
2002-08-31 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* Makefile: Don't use rule for crt%.o, spell it out as rules for
|
* Makefile: Don't use rule for crt%.o, spell it out as rules for
|
||||||
|
@ -25,6 +25,9 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
|
|||||||
_LIBC_TSD_KEY_DL_ERROR,
|
_LIBC_TSD_KEY_DL_ERROR,
|
||||||
_LIBC_TSD_KEY_RPC_VARS,
|
_LIBC_TSD_KEY_RPC_VARS,
|
||||||
_LIBC_TSD_KEY_LOCALE,
|
_LIBC_TSD_KEY_LOCALE,
|
||||||
|
_LIBC_TSD_KEY_CTYPE_B,
|
||||||
|
_LIBC_TSD_KEY_CTYPE_TOLOWER,
|
||||||
|
_LIBC_TSD_KEY_CTYPE_TOUPPER,
|
||||||
_LIBC_TSD_KEY_N };
|
_LIBC_TSD_KEY_N };
|
||||||
|
|
||||||
#include <tls.h>
|
#include <tls.h>
|
||||||
@ -39,6 +42,13 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
|
|||||||
extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW;
|
extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t) __THROW;
|
||||||
extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
|
extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t,
|
||||||
__const void *) __THROW;
|
__const void *) __THROW;
|
||||||
|
extern void **(*const __libc_internal_tsd_address) (enum __libc_tsd_key_t)
|
||||||
|
__THROW __attribute__ ((__const__));
|
||||||
|
|
||||||
|
#define __libc_tsd_address(KEY) \
|
||||||
|
(__libc_internal_tsd_address != NULL \
|
||||||
|
? __libc_internal_tsd_address (_LIBC_TSD_KEY_##KEY) \
|
||||||
|
: &__libc_tsd_##KEY##_data)
|
||||||
|
|
||||||
#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
||||||
#define __libc_tsd_get(KEY) \
|
#define __libc_tsd_get(KEY) \
|
||||||
|
@ -25,46 +25,48 @@
|
|||||||
_NL_CURRENT_DEFINE (LC_CTYPE);
|
_NL_CURRENT_DEFINE (LC_CTYPE);
|
||||||
|
|
||||||
/* We are called after loading LC_CTYPE data to load it into
|
/* We are called after loading LC_CTYPE data to load it into
|
||||||
the variables used by the ctype.h macros.
|
the variables used by the ctype.h macros. */
|
||||||
|
|
||||||
There are three arrays of short ints which need to be indexable
|
|
||||||
from -128 to 255 inclusive. Stored in the locale data file are
|
|
||||||
a copy of each for each byte order. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_nl_postload_ctype (void)
|
_nl_postload_ctype (void)
|
||||||
{
|
{
|
||||||
const struct locale_data *data = _NL_CURRENT_DATA (LC_CTYPE);
|
|
||||||
|
|
||||||
#define paste(a,b) paste1(a,b)
|
|
||||||
#define paste1(a,b) a##b
|
|
||||||
|
|
||||||
#define current(type,x,offset) \
|
#define current(type,x,offset) \
|
||||||
((const type *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) + offset)
|
((const type *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_##x) + offset)
|
||||||
|
|
||||||
extern const uint32_t *__ctype32_b;
|
/* These are defined in ctype-info.c.
|
||||||
extern const uint32_t *__ctype32_toupper;
|
The declarations here must match those in localeinfo.h.
|
||||||
extern const uint32_t *__ctype32_tolower;
|
|
||||||
extern const char *__ctype32_wctype[12] attribute_hidden;
|
|
||||||
extern const char *__ctype32_wctrans[2] attribute_hidden;
|
|
||||||
extern const char *__ctype32_width attribute_hidden;
|
|
||||||
|
|
||||||
size_t offset, cnt;
|
These point into arrays of 384, so they can be indexed by any `unsigned
|
||||||
|
char' value [0,255]; by EOF (-1); or by any `signed char' value
|
||||||
|
[-128,-1). ISO C requires that the ctype functions work for `unsigned
|
||||||
|
char' values and for EOF; we also support negative `signed char' values
|
||||||
|
for broken old programs. The case conversion arrays are of `int's
|
||||||
|
rather than `unsigned char's because tolower (EOF) must be EOF, which
|
||||||
|
doesn't fit into an `unsigned char'. But today more important is that
|
||||||
|
the arrays are also used for multi-byte character sets. */
|
||||||
|
|
||||||
__ctype_b = current (uint16_t, CLASS, 128);
|
if (_NL_CURRENT_LOCALE == &_nl_global_locale)
|
||||||
__ctype_toupper = current (uint32_t, TOUPPER, 128);
|
{
|
||||||
__ctype_tolower = current (uint32_t, TOLOWER, 128);
|
__libc_tsd_set (CTYPE_B, (void *) current (uint16_t, CLASS, 128));
|
||||||
__ctype32_b = current (uint32_t, CLASS32, 0);
|
__libc_tsd_set (CTYPE_TOUPPER, (void *) current (int32_t, TOUPPER, 128));
|
||||||
__ctype32_toupper = current (uint32_t, TOUPPER32, 0);
|
__libc_tsd_set (CTYPE_TOLOWER, (void *) current (int32_t, TOLOWER, 128));
|
||||||
__ctype32_tolower = current (uint32_t, TOLOWER32, 0);
|
}
|
||||||
|
|
||||||
offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET);
|
#include <shlib-compat.h>
|
||||||
for (cnt = 0; cnt < 12; cnt++)
|
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
||||||
__ctype32_wctype[cnt] = data->values[offset + cnt].string;
|
extern __const unsigned short int *__ctype_old_b; /* Characteristics. */
|
||||||
|
extern __const __int32_t *__ctype_old_tolower; /* Case conversions. */
|
||||||
|
extern __const __int32_t *__ctype_old_toupper; /* Case conversions. */
|
||||||
|
|
||||||
offset = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET);
|
extern const uint32_t *__ctype32_old_b;
|
||||||
for (cnt = 0; cnt < 2; cnt++)
|
extern const uint32_t *__ctype32_old_toupper;
|
||||||
__ctype32_wctrans[cnt] = data->values[offset + cnt].string;
|
extern const uint32_t *__ctype32_old_tolower;
|
||||||
|
|
||||||
__ctype32_width = current (char, WIDTH, 0);
|
__ctype_old_b = current (uint16_t, CLASS, 128);
|
||||||
|
__ctype_old_toupper = current (uint32_t, TOUPPER, 128);
|
||||||
|
__ctype_old_tolower = current (uint32_t, TOLOWER, 128);
|
||||||
|
__ctype32_old_b = current (uint32_t, CLASS32, 0);
|
||||||
|
__ctype32_old_toupper = current (uint32_t, TOUPPER32, 0);
|
||||||
|
__ctype32_old_tolower = current (uint32_t, TOLOWER32, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include "localeinfo.h"
|
#include "localeinfo.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
/* Switch the current thread's locale to DATASET.
|
/* Switch the current thread's locale to DATASET.
|
||||||
If DATASET is null, instead just return the current setting.
|
If DATASET is null, instead just return the current setting.
|
||||||
@ -60,6 +61,11 @@ __uselocale (locale_t newloc)
|
|||||||
# include "categories.def"
|
# include "categories.def"
|
||||||
# undef DEFINE_CATEGORY
|
# undef DEFINE_CATEGORY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Update the special tsd cache of some locale data. */
|
||||||
|
__libc_tsd_set (CTYPE_B, (void *) locobj->__ctype_b);
|
||||||
|
__libc_tsd_set (CTYPE_TOLOWER, (void *) locobj->__ctype_tolower);
|
||||||
|
__libc_tsd_set (CTYPE_TOUPPER, (void *) locobj->__ctype_toupper);
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc;
|
return oldloc == &_nl_global_locale ? LC_GLOBAL_LOCALE : oldloc;
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
keys used in only one source file,
|
keys used in only one source file,
|
||||||
empty for global definitions, or
|
empty for global definitions, or
|
||||||
`extern' for global declarations.
|
`extern' for global declarations.
|
||||||
|
__libc_tsd_address(KEY) -- Return the `void **' pointing to
|
||||||
|
the current thread's datum for KEY.
|
||||||
__libc_tsd_get(KEY) -- Return the `void *' datum for KEY.
|
__libc_tsd_get(KEY) -- Return the `void *' datum for KEY.
|
||||||
__libc_tsd_set(KEY, VALUE) -- Set the datum for KEY to VALUE.
|
__libc_tsd_set(KEY, VALUE) -- Set the datum for KEY to VALUE.
|
||||||
|
|
||||||
@ -52,11 +54,13 @@
|
|||||||
#if USE_TLS && HAVE___THREAD
|
#if USE_TLS && HAVE___THREAD
|
||||||
# define __libc_tsd_define(CLASS, KEY) CLASS __thread void *__libc_tsd_##KEY;
|
# define __libc_tsd_define(CLASS, KEY) CLASS __thread void *__libc_tsd_##KEY;
|
||||||
|
|
||||||
|
# define __libc_tsd_address(KEY) (&__libc_tsd_##KEY)
|
||||||
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY)
|
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY)
|
||||||
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
|
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY = (VALUE))
|
||||||
#else
|
#else
|
||||||
# define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
# define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
|
||||||
|
|
||||||
|
# define __libc_tsd_address(KEY) (&__libc_tsd_##KEY)
|
||||||
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY##_data)
|
# define __libc_tsd_get(KEY) (__libc_tsd_##KEY##_data)
|
||||||
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY##_data = (VALUE))
|
# define __libc_tsd_set(KEY, VALUE) (__libc_tsd_##KEY##_data = (VALUE))
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* libc-internal interface for thread-specific data. Hurd version.
|
/* libc-internal interface for thread-specific data. Hurd version.
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
Copyright (C) 1998,2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -24,14 +24,11 @@
|
|||||||
|
|
||||||
#define __libc_tsd_define(CLASS, KEY) /* nothing, always have threadvars */
|
#define __libc_tsd_define(CLASS, KEY) /* nothing, always have threadvars */
|
||||||
|
|
||||||
#define __libc_tsd_threadvar_location(KEY) \
|
#define __libc_tsd_address(KEY) \
|
||||||
((void **) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
|
((void **) __hurd_threadvar_location (_HURD_THREADVAR_##KEY))
|
||||||
|
|
||||||
#define __libc_tsd_get(KEY) \
|
#define __libc_tsd_get(KEY) (*__libc_tsd_address (KEY))
|
||||||
(*__libc_tsd_threadvar_location (KEY))
|
#define __libc_tsd_set(KEY, VALUE) (*__libc_tsd_address (KEY) = (VALUE))
|
||||||
|
|
||||||
#define __libc_tsd_set(KEY, VALUE) \
|
|
||||||
(*__libc_tsd_threadvar_location (KEY) = (VALUE))
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* bits/libc-tsd.h */
|
#endif /* bits/libc-tsd.h */
|
||||||
|
Reference in New Issue
Block a user