diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-02 10:30:25 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2017-12-02 10:30:25 +0100 |
commit | 44a3eaeba04ef78835ca741592c376428ada5f71 (patch) | |
tree | 29cc935fd475678dcbe38972bfa77fdc68ffb10d /lib/localcharset.c | |
parent | 6b73edd95d603e27d55d4905134ac1327d426534 (diff) |
New upstream version 0.9.8upstream/0.9.8
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 0e5383e..8f07380 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" |