1 /* Convert string representation of a number into an integer value.
2 Copyright (C) 1991-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 #undef __GLIBC_USE_C2X_STRTOL
21 #define __GLIBC_USE_C2X_STRTOL 0
24 #include <locale/localeinfo.h>
30 # define INT unsigned LONG int
36 # define strtol wcstoull
37 # define __strtol_l __wcstoull_l
38 # define __isoc23_strtol __isoc23_wcstoull
40 # define strtol wcstoul
41 # define __strtol_l __wcstoul_l
42 # define __isoc23_strtol __isoc23_wcstoul
46 # define strtol strtoull
47 # define __strtol_l __strtoull_l
48 # define __isoc23_strtol __isoc23_strtoull
50 # define strtol strtoul
51 # define __strtol_l __strtoul_l
52 # define __isoc23_strtol __isoc23_strtoul
58 # define strtol wcstoll
59 # define __strtol_l __wcstoll_l
60 # define __isoc23_strtol __isoc23_wcstoll
62 # define strtol wcstol
63 # define __strtol_l __wcstol_l
64 # define __isoc23_strtol __isoc23_wcstol
68 # define strtol strtoll
69 # define __strtol_l __strtoll_l
70 # define __isoc23_strtol __isoc23_strtoll
76 /* If QUAD is defined, we are defining `strtoll' or `strtoull',
77 operating on `long long int's. */
79 # define LONG long long
86 # define STRING_TYPE wchar_t
88 # define STRING_TYPE char
92 #define INTERNAL(X) INTERNAL1(X)
93 #define INTERNAL1(X) __##X##_internal
95 #define SYM__(X) SYM__1 (X)
96 #define SYM__1(X) __ ## X
97 #define __strtol SYM__ (strtol)
100 extern INT
INTERNAL (__strtol_l
) (const STRING_TYPE
*, STRING_TYPE
**, int,
101 int, bool, locale_t
);
105 INTERNAL (strtol
) (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
,
108 return INTERNAL (__strtol_l
) (nptr
, endptr
, base
, group
, false,
111 libc_hidden_def (INTERNAL (strtol
))
115 __strtol (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
, int base
)
117 return INTERNAL (__strtol_l
) (nptr
, endptr
, base
, 0, false,
120 weak_alias (__strtol
, strtol
)
121 libc_hidden_weak (strtol
)
124 __isoc23_strtol (const STRING_TYPE
*nptr
, STRING_TYPE
**endptr
, int base
)
126 return INTERNAL (__strtol_l
) (nptr
, endptr
, base
, 0, true,
129 libc_hidden_def (__isoc23_strtol
)