summaryrefslogtreecommitdiff
path: root/lib/encodings.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2011-03-20 12:59:02 +0000
committerColin Watson <cjwatson@debian.org>2011-03-20 12:59:02 +0000
commit34b38e61fd4f1ed342c47390646606839282724a (patch)
tree5f50cec6787aee6606198d2678fe033088517c71 /lib/encodings.c
parent52d0d5db998461171da2cd7222daaa982672cf18 (diff)
Remove the need for our patched version of xstrdup.
* lib/encodings.c (get_locale_charset): Check return value of setlocale before passing to xstrdup. (find_charset_locale): Likewise. * lib/pathsearch.c (pathsearch): Check return value of getenv before passing to xstrdup. (pathsearch_executable): Likewise. * lib/tempfile.c (create_tempdir): Adjust appendstr call to avoid needing to pass return value of path_search to xstrdup. * src/check_mandirs.c (test_manfile): Don't pass NULL lg.whatis to xstrdup. * src/descriptions.c (parse_descriptions): Don't pass NULL head->whatis to xstrdup. * src/man.c (main): Check return value of setlocale before passing to xstrdup. (add_col): Only call find_charset_locale if locale_charset is non-NULL. (add_candidate): Don't pass NULL ult to xstrdup. * src/manp.c (read_config_file): Adjust appendstr call to avoid needing to pass return value of getenv to xstrdup. * src/whatis.c (do_apropos): Don't pass NULL info.whatis to xstrdup. (main): Check return value of setlocale before passing to xstrdup. * src/zsoelim.l (zsoelim_stdin_data_new): Don't pass NULL path to xstrdup. * Makefile.am (EXTRA_DIST): Remove gnulib/lib/xmalloc.c.orig and gnulib/lib/xmalloc.patch. * autogen.sh: Stop applying gnulib/lib/xmalloc.patch. * gnulib/lib/xmalloc.c.orig, gnulib/lib/xmalloc.patch: Remove.
Diffstat (limited to 'lib/encodings.c')
-rw-r--r--lib/encodings.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/encodings.c b/lib/encodings.c
index 20556692..96d15f56 100644
--- a/lib/encodings.c
+++ b/lib/encodings.c
@@ -550,7 +550,9 @@ const char *get_locale_charset (void)
/* We need to modify LC_CTYPE temporarily in order to look at the
* codeset, so save it first.
*/
- saved_locale = xstrdup (setlocale (LC_CTYPE, NULL));
+ saved_locale = setlocale (LC_CTYPE, NULL);
+ if (saved_locale)
+ saved_locale = xstrdup (saved_locale);
ctype = setlocale (LC_CTYPE, "");
@@ -588,7 +590,9 @@ char *find_charset_locale (const char *charset)
if (!supported)
return NULL;
- saved_locale = xstrdup (setlocale (LC_CTYPE, NULL));
+ saved_locale = setlocale (LC_CTYPE, NULL);
+ if (saved_locale)
+ saved_locale = xstrdup (saved_locale);
while (getline (&line, &n, supported) >= 0) {
const char *space = strchr (line, ' ');