diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-02 12:05:34 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-02 12:05:34 +0100 |
commit | 7c78c92a28ef43d68b172adf97fbd8a27be3baec (patch) | |
tree | 3a98b0d01865f5e00912521c58386eb008a70d07 /lib/localcharset.c | |
parent | 4d76768442551c97a85e6f133cb818d223012746 (diff) | |
parent | 3ee36dc9787cee6ab5314af8f9c01b05a50e7d9d (diff) |
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'lib/localcharset.c')
-rw-r--r-- | lib/localcharset.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/localcharset.c b/lib/localcharset.c index 0e5383ef..8f07380c 100644 --- a/lib/localcharset.c +++ b/lib/localcharset.c @@ -1,6 +1,6 @@ /* Determine a canonical name for the current locale's character encoding. - Copyright (C) 2000-2006, 2008-2016 Free Software Foundation, Inc. + Copyright (C) 2000-2006, 2008-2017 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of either: @@ -22,7 +22,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, see <http://www.gnu.org/licenses/>. */ + with this program; if not, see <https://www.gnu.org/licenses/>. */ /* Written by Bruno Haible <bruno@clisp.org>. */ @@ -41,7 +41,7 @@ # define DARWIN7 /* Darwin 7 or newer, i.e. Mac OS X 10.3 or newer */ #endif -#if defined _WIN32 || defined __WIN32__ +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ # define WINDOWS_NATIVE # include <locale.h> #endif @@ -84,6 +84,7 @@ # include "relocatable.h" #else # define relocate(pathname) (pathname) +# define relocate2(pathname,allocatedp) (*(allocatedp) = NULL, (pathname)) #endif /* Get LIBDIR. */ @@ -138,6 +139,7 @@ get_charset_aliases (void) if (cp == NULL) { #if !(defined DARWIN7 || defined VMS || defined WINDOWS_NATIVE || defined __CYGWIN__ || defined OS2) + char *malloc_dir = NULL; const char *dir; const char *base = "charset.alias"; char *file_name; @@ -146,7 +148,7 @@ get_charset_aliases (void) necessary for running the testsuite before "make install". */ dir = getenv ("CHARSETALIASDIR"); if (dir == NULL || dir[0] == '\0') - dir = relocate (LIBDIR); + dir = relocate2 (LIBDIR, &malloc_dir); /* Concatenate dir and base into freshly allocated file_name. */ { @@ -163,6 +165,8 @@ get_charset_aliases (void) } } + free (malloc_dir); + if (file_name == NULL) /* Out of memory. Treat the file as empty. */ cp = ""; @@ -360,7 +364,7 @@ get_charset_aliases (void) by Alex Taylor: <http://altsan.org/os2/toolkits/uls/index.html#codepages>. See also "IBM Globalization - Code page identifiers": - <http://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ + <https://www-01.ibm.com/software/globalization/cp/cp_cpgid.html>. */ cp = "CP813" "\0" "ISO-8859-7" "\0" "CP878" "\0" "KOI8-R" "\0" "CP819" "\0" "ISO-8859-1" "\0" |