Remove building with NOCRYPTO option
[minix3.git] / lib / libc / gdtoa / strtold_subr.c
blob1f5e1aa5900f589ba955ba9c043184e3063f989e
1 /* $NetBSD: strtold_subr.c,v 1.3 2013/05/17 12:55:57 joerg Exp $ */
3 /*
4 * Written by Klaus Klein <kleink@NetBSD.org>, November 16, 2005.
5 * Public domain.
6 */
8 /*
9 * NOTICE: This is not a standalone file. To use it, #include it in
10 * the format-specific strtold_*.c, like so:
12 * #define GDTOA_LD_FMT <gdtoa extended-precision format code>
13 * #include "strtold_subr.c"
16 #include <sys/cdefs.h>
17 #if defined(LIBC_SCCS) && !defined(lint)
18 __RCSID("$NetBSD: strtold_subr.c,v 1.3 2013/05/17 12:55:57 joerg Exp $");
19 #endif /* LIBC_SCCS and not lint */
21 #include "namespace.h"
22 #include <math.h>
23 #include <stdlib.h>
24 #include "gdtoa.h"
26 #include <locale.h>
27 #include "setlocale_local.h"
29 #ifdef __weak_alias
30 __weak_alias(strtold, _strtold)
31 __weak_alias(strtold_l, _strtold_l)
32 #endif
34 #ifndef __HAVE_LONG_DOUBLE
35 #error no extended-precision long double type
36 #endif
38 #ifndef GDTOA_LD_FMT
39 #error GDTOA_LD_FMT must be defined by format-specific source file
40 #endif
42 #define STRTOP(x) __CONCAT(strtop, x)
44 static long double
45 _int_strtold_l(const char *nptr, char **endptr, locale_t loc)
47 long double ld;
49 (void)STRTOP(GDTOA_LD_FMT)(nptr, endptr, &ld, loc);
50 return ld;
53 long double
54 strtold(CONST char *s, char **sp)
56 return _int_strtold_l(s, sp, _current_locale());
59 long double
60 strtold_l(CONST char *s, char **sp, locale_t loc)
62 return _int_strtold_l(s, sp, loc);