some coverity fixes.
[minix.git] / lib / libc / gdtoa / strtold_subr.c
blob3a9059ff85beaafbc6714c410d578ac25419ee17
1 /* $NetBSD: strtold_subr.c,v 1.1 2006/03/15 17:35:18 kleink 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.1 2006/03/15 17:35:18 kleink 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 #ifdef __weak_alias
27 __weak_alias(strtold, _strtold)
28 #endif
30 #ifndef __HAVE_LONG_DOUBLE
31 #error no extended-precision long double type
32 #endif
34 #ifndef GDTOA_LD_FMT
35 #error GDTOA_LD_FMT must be defined by format-specific source file
36 #endif
38 #define STRTOP(x) __CONCAT(strtop, x)
40 long double
41 strtold(const char *nptr, char **endptr)
43 long double ld;
45 (void)STRTOP(GDTOA_LD_FMT)(nptr, endptr, &ld);
46 return ld;