1 // -*- C++ -*-
2 //===-----------------------------------------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 // These are reimplementations of some extended locale functions ( *_l ) that
10 // aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe
11 // others). The unifying aspect in this case is that all of these functions
12 // convert strings to some numeric type.
13 //===----------------------------------------------------------------------===//
14
15 #ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
16 #define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
strtof_l(const char * nptr,char ** endptr,locale_t)22 inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char *nptr,
23 char **endptr, locale_t) {
24 return ::strtof(nptr, endptr);
25 }
26
strtod_l(const char * nptr,char ** endptr,locale_t)27 inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char *nptr,
28 char **endptr, locale_t) {
29 return ::strtod(nptr, endptr);
30 }
31
strtold_l(const char * nptr,char ** endptr,locale_t)32 inline _LIBCPP_INLINE_VISIBILITY long double strtold_l(const char *nptr,
33 char **endptr, locale_t) {
34 return ::strtold(nptr, endptr);
35 }
36
37 inline _LIBCPP_INLINE_VISIBILITY long long
strtoll_l(const char * nptr,char ** endptr,int base,locale_t)38 strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
39 return ::strtoll(nptr, endptr, base);
40 }
41
42 inline _LIBCPP_INLINE_VISIBILITY unsigned long long
strtoull_l(const char * nptr,char ** endptr,int base,locale_t)43 strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
44 return ::strtoull(nptr, endptr, base);
45 }
46
47 inline _LIBCPP_INLINE_VISIBILITY long long
wcstoll_l(const wchar_t * nptr,wchar_t ** endptr,int base,locale_t)48 wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
49 return ::wcstoll(nptr, endptr, base);
50 }
51
52 inline _LIBCPP_INLINE_VISIBILITY unsigned long long
wcstoull_l(const wchar_t * nptr,wchar_t ** endptr,int base,locale_t)53 wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
54 return ::wcstoull(nptr, endptr, base);
55 }
56
wcstold_l(const wchar_t * nptr,wchar_t ** endptr,locale_t)57 inline _LIBCPP_INLINE_VISIBILITY long double wcstold_l(const wchar_t *nptr,
58 wchar_t **endptr, locale_t) {
59 return ::wcstold(nptr, endptr);
60 }
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H
67