xlocale.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. #ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
  18. #define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
  19. #include <cstdlib>
  20. #include <cwchar>
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. static inline long long strtoll_l(const char *nptr, char **endptr, int base,
  25. locale_t) {
  26. return strtoll(nptr, endptr, base);
  27. }
  28. static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
  29. int base, locale_t) {
  30. return strtoull(nptr, endptr, base);
  31. }
  32. static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
  33. int base, locale_t) {
  34. return wcstoll(nptr, endptr, base);
  35. }
  36. static inline unsigned long long wcstoull_l(const wchar_t *nptr,
  37. wchar_t **endptr, int base,
  38. locale_t) {
  39. return wcstoull(nptr, endptr, base);
  40. }
  41. static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
  42. locale_t) {
  43. return wcstold(nptr, endptr);
  44. }
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H