summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arch/vax/gdtoa/hdtoa.c19
-rw-r--r--lib/libc/arch/vax/gdtoa/strtof.c7
2 files changed, 6 insertions, 20 deletions
diff --git a/lib/libc/arch/vax/gdtoa/hdtoa.c b/lib/libc/arch/vax/gdtoa/hdtoa.c
index dc95c0e2eae..a844e251767 100644
--- a/lib/libc/arch/vax/gdtoa/hdtoa.c
+++ b/lib/libc/arch/vax/gdtoa/hdtoa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hdtoa.c,v 1.1 2008/09/07 20:36:08 martynas Exp $ */
+/* $OpenBSD: hdtoa.c,v 1.2 2011/06/08 22:14:17 martynas Exp $ */
/*-
* Copyright (c) 2004, 2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -33,12 +33,7 @@
#include "gdtoaimp.h"
-/* Strings values used by dtoa() */
-#define INFSTR "Infinity"
-#define NANSTR "NaN"
-
#define DBL_ADJ (DBL_MAX_EXP - 2 + ((DBL_MANT_DIG - 1) % 4))
-#define LDBL_ADJ (LDBL_MAX_EXP - 2 + ((LDBL_MANT_DIG - 1) % 4))
/*
* Round up the given digit string. If the digit string is fff...f,
@@ -137,16 +132,6 @@ __hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
case FP_ZERO:
*decpt = 1;
return (nrv_alloc("0", rve, 1));
- case FP_SUBNORMAL:
- d *= 0x1p514;
- *decpt = p->dflt_exp - (514 + DBL_ADJ);
- break;
- case FP_INFINITE:
- *decpt = INT_MAX;
- return (nrv_alloc(INFSTR, rve, sizeof(INFSTR) - 1));
- case FP_NAN:
- *decpt = INT_MAX;
- return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1));
default:
abort();
}
@@ -162,6 +147,8 @@ __hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign,
*/
bufsize = (sigfigs > ndigits) ? sigfigs : ndigits;
s0 = rv_alloc(bufsize);
+ if (s0 == NULL)
+ return (NULL);
/*
* We work from right to left, first adding any requested zero
diff --git a/lib/libc/arch/vax/gdtoa/strtof.c b/lib/libc/arch/vax/gdtoa/strtof.c
index 11105f0effd..7406440582c 100644
--- a/lib/libc/arch/vax/gdtoa/strtof.c
+++ b/lib/libc/arch/vax/gdtoa/strtof.c
@@ -62,13 +62,12 @@ strtof(CONST char *s, char **sp)
((exp + 128 + 1 + 23) << 7); /* Exp */
break;
+ case STRTOG_NoMemory:
+ errno = ERANGE;
+ /* FALLTHROUGH */
case STRTOG_Infinite:
u.L[0] = 0xffff7fff;
break;
-
- case STRTOG_NoMemory:
- errno = ERANGE;
- return (HUGE_VALF);
}
if (k & STRTOG_Neg)
u.L[0] |= 0x00008000L;