• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // -*- C++ -*-
2 //===------------------- support/musl/xlocale.h ------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10 // This adds support for the extended locale functions that are currently
11 // missing from the Musl C library.
12 //
13 // This only works when the specified locale is "C" or "POSIX", but that's
14 // about as good as we can do without implementing full xlocale support
15 // in Musl.
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
19 #define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
20 
21 #include <cstdlib>
22 #include <cwchar>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
strtoll_l(const char * nptr,char ** endptr,int base,locale_t)28 static inline long long strtoll_l(const char *nptr, char **endptr, int base,
29                                   locale_t) {
30   return strtoll(nptr, endptr, base);
31 }
32 
strtoull_l(const char * nptr,char ** endptr,int base,locale_t)33 static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
34                                             int base, locale_t) {
35   return strtoull(nptr, endptr, base);
36 }
37 
wcstoll_l(const wchar_t * nptr,wchar_t ** endptr,int base,locale_t)38 static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
39                                   int base, locale_t) {
40   return wcstoll(nptr, endptr, base);
41 }
42 
wcstoull_l(const wchar_t * nptr,wchar_t ** endptr,int base,locale_t)43 static inline unsigned long long wcstoull_l(const wchar_t *nptr,
44                                             wchar_t **endptr, int base,
45                                             locale_t) {
46   return wcstoull(nptr, endptr, base);
47 }
48 
wcstold_l(const wchar_t * nptr,wchar_t ** endptr,locale_t)49 static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
50                                     locale_t) {
51   return wcstold(nptr, endptr);
52 }
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H
59