Ben Craig | fc1962d | 2016-05-20 12:58:41 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===-------------- support/xlocale/__strtonum_fallback.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 | // These are reimplementations of some extended locale functions ( *_l ) that |
| 11 | // aren't part of POSIX. They are widely available though (GLIBC, BSD, maybe |
| 12 | // others). The unifying aspect in this case is that all of these functions |
| 13 | // convert strings to some numeric type. |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H |
| 17 | #define _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H |
| 18 | |
| 19 | #ifdef __cplusplus |
| 20 | extern "C" { |
| 21 | #endif |
| 22 | inline _LIBCPP_ALWAYS_INLINE long double strtold_l(const char *nptr, |
| 23 | char **endptr, locale_t) { |
| 24 | return ::strtold(nptr, endptr); |
| 25 | } |
| 26 | |
| 27 | inline _LIBCPP_ALWAYS_INLINE long long |
| 28 | strtoll_l(const char *nptr, char **endptr, int base, locale_t) { |
| 29 | return ::strtoll(nptr, endptr, base); |
| 30 | } |
| 31 | |
| 32 | inline _LIBCPP_ALWAYS_INLINE unsigned long long |
| 33 | strtoull_l(const char *nptr, char **endptr, int base, locale_t) { |
| 34 | return ::strtoull(nptr, endptr, base); |
| 35 | } |
| 36 | |
| 37 | inline _LIBCPP_ALWAYS_INLINE long long |
| 38 | wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) { |
| 39 | return ::wcstoll(nptr, endptr, base); |
| 40 | } |
| 41 | |
| 42 | inline _LIBCPP_ALWAYS_INLINE unsigned long long |
| 43 | wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) { |
| 44 | return ::wcstoull(nptr, endptr, base); |
| 45 | } |
| 46 | |
| 47 | inline _LIBCPP_ALWAYS_INLINE long double wcstold_l(const wchar_t *nptr, |
| 48 | wchar_t **endptr, locale_t) { |
| 49 | return ::wcstold(nptr, endptr); |
| 50 | } |
| 51 | |
| 52 | #ifdef __cplusplus |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | #endif // _LIBCPP_SUPPORT_XLOCALE_STRTONUM_FALLBACK_H |