#include <errno.h>
#include <locale.h>
#include <stdlib.h>
-
-#include "xalloc.h"
+#include <string.h>
#if LONG
# define C_STRTOD c_strtold
locale_t locale = c_locale ();
if (!locale)
- return 0; /* errno is set here */
+ {
+ if (endptr)
+ *endptr = (char *) nptr;
+ return 0; /* errno is set here */
+ }
r = STRTOD_L (nptr, endptr, locale);
if (saved_locale)
{
- saved_locale = xstrdup (saved_locale);
+ saved_locale = strdup (saved_locale);
+ if (saved_locale == NULL)
+ {
+ if (endptr)
+ *endptr = (char *) nptr;
+ return 0; /* errno is set here */
+ }
setlocale (LC_NUMERIC, "C");
}