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 // This adds support for the extended locale functions that are currently
10 // missing from the Musl C library.
11 //
12 // This only works when the specified locale is "C" or "POSIX", but that's
13 // about as good as we can do without implementing full xlocale support
14 // in Musl.
15 //===----------------------------------------------------------------------===//
16
17 #ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
18 #define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
19
20 #include <cstdlib>
21 #include <cwchar>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
strtoll_l(const char * nptr,char ** endptr,int base,locale_t)27 static inline long long strtoll_l(const char *nptr, char **endptr, int base,
28 locale_t) {
29 return strtoll(nptr, endptr, base);
30 }
31
strtoull_l(const char * nptr,char ** endptr,int base,locale_t)32 static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
33 int base, locale_t) {
34 return strtoull(nptr, endptr, base);
35 }
36
wcstoll_l(const wchar_t * nptr,wchar_t ** endptr,int base,locale_t)37 static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
38 int base, locale_t) {
39 return wcstoll(nptr, endptr, base);
40 }
41
wcstoull_l(const wchar_t * nptr,wchar_t ** endptr,int base,locale_t)42 static inline unsigned long long wcstoull_l(const wchar_t *nptr,
43 wchar_t **endptr, int base,
44 locale_t) {
45 return wcstoull(nptr, endptr, base);
46 }
47
wcstold_l(const wchar_t * nptr,wchar_t ** endptr,locale_t)48 static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
49 locale_t) {
50 return wcstold(nptr, endptr);
51 }
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H
58