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
19extern "C" {
20#endif
21
22inline _LIBCPP_INLINE_VISIBILITY float strtof_l(const char *nptr,
23                                                char **endptr, locale_t) {
24  return ::strtof(nptr, endptr);
25}
26
27inline _LIBCPP_INLINE_VISIBILITY double strtod_l(const char *nptr,
28                                                 char **endptr, locale_t) {
29  return ::strtod(nptr, endptr);
30}
31
32inline _LIBCPP_INLINE_VISIBILITY long double strtold_l(const char *nptr,
33                                                       char **endptr, locale_t) {
34  return ::strtold(nptr, endptr);
35}
36
37inline _LIBCPP_INLINE_VISIBILITY long long
38strtoll_l(const char *nptr, char **endptr, int base, locale_t) {
39  return ::strtoll(nptr, endptr, base);
40}
41
42inline _LIBCPP_INLINE_VISIBILITY unsigned long long
43strtoull_l(const char *nptr, char **endptr, int base, locale_t) {
44  return ::strtoull(nptr, endptr, base);
45}
46
47inline _LIBCPP_INLINE_VISIBILITY long long
48wcstoll_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
49  return ::wcstoll(nptr, endptr, base);
50}
51
52inline _LIBCPP_INLINE_VISIBILITY unsigned long long
53wcstoull_l(const wchar_t *nptr, wchar_t **endptr, int base, locale_t) {
54  return ::wcstoull(nptr, endptr, base);
55}
56
57inline _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