diff options
author | Bruno Haible <bruno@clisp.org> | 2009-01-23 23:41:16 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-01-23 23:41:16 +0100 |
commit | 5965a9b1d0011a0340b57e1faa0b8a3f7997c519 (patch) | |
tree | e08d76fba9b8c9c66f0abd402b2838a9da64ebd8 /lib/c-strtod.c | |
parent | 9977632d05c1d68363901d6a4f4743ce06f153d2 (diff) | |
download | gnulib-5965a9b1d0011a0340b57e1faa0b8a3f7997c519.tar.gz |
Change c_strtod, c_strtold to no longer call xalloc_die().
Diffstat (limited to 'lib/c-strtod.c')
-rw-r--r-- | lib/c-strtod.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/c-strtod.c b/lib/c-strtod.c index 77e5aaf80d..9723e0b788 100644 --- a/lib/c-strtod.c +++ b/lib/c-strtod.c @@ -24,8 +24,7 @@ #include <errno.h> #include <locale.h> #include <stdlib.h> - -#include "xalloc.h" +#include <string.h> #if LONG # define C_STRTOD c_strtold @@ -74,7 +73,7 @@ C_STRTOD (char const *nptr, char **endptr) if (!locale) { if (endptr) - *endptr = nptr; + *endptr = nptr; return 0; /* errno is set here */ } @@ -86,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 = nptr; + return 0; /* errno is set here */ + } setlocale (LC_NUMERIC, "C"); } |