1 /* Convert string representation of a number into an integer value.
2 Copyright (C) 1991-2019 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/>. */
21 #include <locale/localeinfo.h>
27 # define INT unsigned LONG int
33 # define strtol wcstoull
34 # define __strtol_l __wcstoull_l
36 # define strtol wcstoul
37 # define __strtol_l __wcstoul_l
41 # define strtol strtoull
42 # define __strtol_l __strtoull_l
44 # define strtol strtoul
45 # define __strtol_l __strtoul_l
51 # define strtol wcstoll
52 # define __strtol_l __wcstoll_l
54 # define strtol wcstol
55 # define __strtol_l __wcstol_l
59 # define strtol strtoll
60 # define __strtol_l __strtoll_l
66 /* If QUAD is defined, we are defining `strtoll' or `strtoull',
67 operating on `long long int's. */
69 # define LONG long long
76 # define STRING_TYPE wchar_t
78 # define STRING_TYPE char
82 #define INTERNAL(X) INTERNAL1(X)
83 #define INTERNAL1(X) __##X##_internal
85 #define SYM__(X) SYM__1 (X)
86 #define SYM__1(X) __ ## X
87 #define __strtol SYM__ (strtol)
90 extern INT INTERNAL (__strtol_l) (const STRING_TYPE *, STRING_TYPE **, int,
95 INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
98 return INTERNAL (__strtol_l) (nptr, endptr, base, group, _NL_CURRENT_LOCALE);
100 libc_hidden_def (INTERNAL (strtol))
104 __strtol (const STRING_TYPE *nptr, STRING_TYPE **endptr, int base)
106 return INTERNAL (__strtol_l) (nptr, endptr, base, 0, _NL_CURRENT_LOCALE);
108 weak_alias (__strtol, strtol)
109 libc_hidden_weak (strtol)