machdep_ldisdd.c.patch   [plain text]


--- machdep_ldisdd.c.orig	2004-09-20 17:32:38.000000000 -0700
+++ machdep_ldisdd.c	2005-02-19 03:07:38.000000000 -0800
@@ -32,13 +32,34 @@
 
 #include <sys/cdefs.h>
 
+#include "xlocale_private.h"
+
 #include "gdtoaimp.h"
 
 long double
 strtold(const char * __restrict s, char ** __restrict sp)
 {
+#ifdef LDBL_COMPAT
+	return (long double)strtod_l(s, sp, __current_locale());
+#else /* LDBL_COMPAT */
+	long double result;
+
+	strtopdd(s, sp, (double *)&result, __current_locale());
+	return result;
+#endif /* LDBL_COMPAT */
+}
+
+long double
+strtold_l(const char * __restrict s, char ** __restrict sp, locale_t loc)
+{
+#ifdef LDBL_COMPAT
+	NORMALIZE_LOCALE(loc);
+	return (long double)strtod_l(s, sp, loc);
+#else /* LDBL_COMPAT */
 	long double result;
 
-	strtopdd(s, sp, &result);
+	NORMALIZE_LOCALE(loc);
+	strtopdd(s, sp, (double *)&result, loc);
 	return result;
+#endif /* LDBL_COMPAT */
 }