]> git.ipfire.org Git - thirdparty/glibc.git/blame - include/ctype.h
Further harden glibc malloc metadata against 1-byte overflows.
[thirdparty/glibc.git] / include / ctype.h
CommitLineData
0f283ffc
RM
1#ifndef _CTYPE_H
2
b4f66884
RM
3#include <ctype/ctype.h>
4
31341567 5#ifndef _ISOMAC
fd5bdc09
UD
6/* Initialize ctype locale data. */
7extern void __ctype_init (void);
8libc_hidden_proto (__ctype_init)
9
b4f66884
RM
10/* ctype/ctype.h defined this as a macro and we don't want to #undef it.
11 So defeat macro expansion with parens for this declaration. */
12extern int (__isctype) (int __c, int __mask);
1ba0f089 13
4f41c682 14# if IS_IN (libc)
0f283ffc 15
cf684340
RM
16/* These accessors are used by the optimized macros to find the
17 thread-local cache of ctype information from the current thread's
18 locale. For inside libc, define them as inlines using the _NL_CURRENT
19 accessors. We don't use _NL_CURRENT_LOCALE->__ctype_b here because we
20 want to cause a link-time ref to _nl_current_LC_CTYPE under
0f283ffc
RM
21 NL_CURRENT_INDIRECT. */
22
23# include "../locale/localeinfo.h"
02d55fe0 24# include <libc-tsd.h>
cf684340
RM
25
26# ifndef CTYPE_EXTERN_INLINE /* Used by ctype/ctype-info.c, which see. */
27# define CTYPE_EXTERN_INLINE extern inline
28# endif
29
4b23f9bd
JJ
30__libc_tsd_define (extern, const uint16_t *, CTYPE_B)
31__libc_tsd_define (extern, const int32_t *, CTYPE_TOUPPER)
32__libc_tsd_define (extern, const int32_t *, CTYPE_TOLOWER)
cf684340 33
fd5bdc09 34
cf684340
RM
35CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
36__ctype_b_loc (void)
37{
fd5bdc09 38 return __libc_tsd_address (const uint16_t *, CTYPE_B);
cf684340
RM
39}
40
41CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
42__ctype_toupper_loc (void)
43{
fd5bdc09 44 return __libc_tsd_address (const int32_t *, CTYPE_TOUPPER);
cf684340
RM
45}
46
47CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
48__ctype_tolower_loc (void)
49{
fd5bdc09 50 return __libc_tsd_address (const int32_t *, CTYPE_TOLOWER);
cf684340
RM
51}
52
b4f66884 53# ifndef __NO_CTYPE
f83aa16c
UD
54/* The spec says that isdigit must only match the decimal digits. We
55 can check this without a memory access. */
b4f66884
RM
56# undef isdigit
57# define isdigit(c) ({ int __c = (c); __c >= '0' && __c <= '9'; })
58# undef isdigit_l
59# define isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
60# undef __isdigit_l
61# define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
62# endif /* Not __NO_CTYPE. */
63
4f41c682 64# endif /* IS_IN (libc). */
b4f66884 65#endif /* Not _ISOMAC. */
f83aa16c 66
0f283ffc 67#endif /* ctype.h */