strtold_l.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright (C) 1999-2019 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, see
  13. <http://www.gnu.org/licenses/>. */
  14. #include <math.h>
  15. #include <stdlib.h>
  16. #include <wchar.h>
  17. #ifdef USE_WIDE_CHAR
  18. # define STRING_TYPE wchar_t
  19. # define STRTOLD wcstold_l
  20. # define __STRTOLD __wcstold_l
  21. # define __STRTOD __wcstod_l
  22. #else
  23. # define STRING_TYPE char
  24. # define STRTOLD strtold_l
  25. # define __STRTOLD __strtold_l
  26. # define __STRTOD __strtod_l
  27. #endif
  28. #define INTERNAL(x) INTERNAL1(x)
  29. #define INTERNAL1(x) __##x##_internal
  30. extern double INTERNAL (__STRTOD) (const STRING_TYPE *, STRING_TYPE **,
  31. int, locale_t);
  32. /* There is no `long double' type, use the `double' implementations. */
  33. long double
  34. INTERNAL (__STRTOLD) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
  35. int group, locale_t loc)
  36. {
  37. return INTERNAL (__STRTOD) (nptr, endptr, group, loc);
  38. }
  39. #ifndef USE_WIDE_CHAR
  40. libc_hidden_def (INTERNAL (__STRTOLD))
  41. #endif
  42. long double
  43. weak_function
  44. __STRTOLD (const STRING_TYPE *nptr, STRING_TYPE **endptr, locale_t loc)
  45. {
  46. return INTERNAL (__STRTOD) (nptr, endptr, 0, loc);
  47. }
  48. #if defined _LIBC
  49. libc_hidden_def (__STRTOLD)
  50. libc_hidden_ver (__STRTOLD, STRTOLD)
  51. #endif
  52. weak_alias (__STRTOLD, STRTOLD)