+2009-01-23 Bruno Haible <bruno@clisp.org>
+
+ Make c-strtod, c-strtold usable in libraries.
+ * lib/c-strtod.c: Include string.h instead of xalloc.h.
+ (C_STRTOD): Call strdup instead of xstrdup.
+ * modules/c-strtod (Depends-on): Add strdup-posix, remove xalloc.
+ * modules/c-strtold (Depends-on): Likewise.
+ * doc/c-strtod.texi: Remove the sentence mentioning xalloc_die.
+ * NEWS: Mention the change.
+ Reported by Michael Gold <mgold@ncf.ca>.
+
2009-01-23 Jim Meyering <meyering@redhat.com>
c-strtod: when ENDPTR is non-NULL, set *ENDPTR in new failure path
Date Modules Changes
+2009-01-22 c-strtod This function no longer calls xalloc_die(). If
+ c-strtold you want to exit the program in case of out-of-
+ memory, the calling function needs to arrange
+ for it, like this:
+ errno = 0;
+ val = c_strtod (...);
+ if (val == 0 && errno == ENOMEM)
+ xalloc_die ();
+
2009-01-17 relocatable-prog In the Makefile.am or Makefile.in, you now also
need to set RELOCATABLE_STRIP = :.
when the current locale's notion of decimal point is a comma @samp{,},
and no characters outside the basic character set are accepted.
-This function aborts via @code{xalloc_die} if it cannot allocate memory.
-On platforms without @code{strtod_l}, it is not safe for use in
+On platforms without @code{strtod_l}, this function is not safe for use in
multi-threaded applications since it calls @code{setlocale}.
#include <errno.h>
#include <locale.h>
#include <stdlib.h>
-
-#include "xalloc.h"
+#include <string.h>
#if LONG
# define C_STRTOD c_strtold
if (!locale)
{
if (endptr)
- *endptr = nptr;
+ *endptr = nptr;
return 0; /* errno is set here */
}
if (saved_locale)
{
- saved_locale = xstrdup (saved_locale);
+ saved_locale = strdup (saved_locale);
+ if (saved_locale == NULL)
+ {
+ if (endptr)
+ *endptr = nptr;
+ return 0; /* errno is set here */
+ }
setlocale (LC_NUMERIC, "C");
}
Depends-on:
extensions
-xalloc
+strdup-posix
configure.ac:
gl_C_STRTOD
Depends-on:
extensions
-xalloc
+strdup-posix
configure.ac:
gl_C_STRTOLD