X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fc-strtod.c;h=51e996e5da0246a70f5a62ddd7f9310fd30b5798;hb=fa3486514bd8f15f8eb4c49821d0356b52e5a335;hp=3d0fae99560dff70ba53334aff83f4faf5bfa2fd;hpb=0f4a0409cb0fa10631b9fe2241a2c8083f37daf5;p=gnulib.git diff --git a/lib/c-strtod.c b/lib/c-strtod.c index 3d0fae995..51e996e5d 100644 --- a/lib/c-strtod.c +++ b/lib/c-strtod.c @@ -24,8 +24,7 @@ #include #include #include - -#include "xalloc.h" +#include #if LONG # define C_STRTOD c_strtold @@ -72,7 +71,11 @@ C_STRTOD (char const *nptr, char **endptr) 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); @@ -82,7 +85,13 @@ C_STRTOD (char const *nptr, char **endptr) 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"); }