Loading...
stdlib/OpenBSD/ecvt.c.patch /dev/null Libc-391
--- /dev/null
+++ Libc/Libc-391/stdlib/OpenBSD/ecvt.c.patch
@@ -0,0 +1,62 @@
+--- ecvt.c.orig	Thu Jul  8 16:06:45 2004
++++ ecvt.c	Fri Jul  9 12:23:51 2004
+@@ -20,6 +20,7 @@
+  * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+  */
+ 
++#include <sys/cdefs.h>
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static char rcsid[] = "$OpenBSD: ecvt.c,v 1.3 2003/06/17 21:56:24 millert Exp $";
+ #endif /* LIBC_SCCS and not lint */
+@@ -29,10 +30,11 @@
+ #include <string.h>
+ 
+ extern char *__dtoa(double, int, int, int *, int *, char **);
++extern void __freedtoa(char *); /* special gdtoa free function */
+ static char *__cvt(double, int, int *, int *, int, int);
+ 
+ static char *
+-__cvt(double value, int ndigit, int *decpt, int *sign, int fmode, int pad)
++__cvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign, int fmode, int pad)
+ {
+ 	static char *s;
+ 	char *p, *rve;
+@@ -68,15 +70,20 @@
+ 		if (*decpt == 9999) {
+ 			/* Nan or Infinity */
+ 			*decpt = 0;
+-			return(p);
++			rve = (*p == 'N') ? "nan" : "inf";
++			__freedtoa(p);
++			return(rve);
+ 		}
+ 		/* make a local copy and adjust rve to be in terms of s */
+ 		if (pad && fmode)
+ 			siz += *decpt;
+-		if ((s = (char *)malloc(siz)) == NULL)
++		if ((s = (char *)malloc(siz)) == NULL) {
++			__freedtoa(p);
+ 			return(NULL);
++		}
+ 		(void) strlcpy(s, p, siz);
+ 		rve = s + (rve - p);
++		__freedtoa(p);
+ 	}
+ 
+ 	/* Add trailing zeros (unless we got NaN or Inf) */
+@@ -91,13 +98,13 @@
+ }
+ 
+ char *
+-ecvt(double value, int ndigit, int *decpt, int *sign)
++ecvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
+ {
+ 	return(__cvt(value, ndigit, decpt, sign, 0, 1));
+ }
+ 
+ char *
+-fcvt(double value, int ndigit, int *decpt, int *sign)
++fcvt(double value, int ndigit, int * __restrict decpt, int * __restrict sign)
+ {
+ 	return(__cvt(value, ndigit, decpt, sign, 1, 1));
+ }