From 343568ad7841c2cd8e0d7fc4076056344db94357 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 23 Nov 2018 22:39:44 +0000 Subject: support non-ascii values for variables (w32 only) git-svn-id: svn://tug.org/texlive/trunk@49236 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/elt-dirs.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/elt-dirs.c b/Build/source/texk/kpathsea/elt-dirs.c index 76fca5513b4..ec60fe82d70 100644 --- a/Build/source/texk/kpathsea/elt-dirs.c +++ b/Build/source/texk/kpathsea/elt-dirs.c @@ -409,6 +409,11 @@ kpathsea_element_dirs (kpathsea kpse, string elt) str_llist_type *ret; unsigned i; +#ifdef _WIN32 + char *tname = NULL; + wchar_t *wtname = NULL; +#endif /* _WIN32 */ + /* If given nothing, return nothing. */ if (!elt || !*elt) return NULL; @@ -419,8 +424,6 @@ kpathsea_element_dirs (kpathsea kpse, string elt) to support non-ascii values for the variable. */ if (kpse->File_system_codepage != kpse->Win32_codepage) { - char *tname; - wchar_t *wtname; wtname = get_wstring_from_mbstring (kpse->Win32_codepage, elt, wtname = NULL); tname = get_mbstring_from_wstring (kpse->File_system_codepage, @@ -428,15 +431,22 @@ kpathsea_element_dirs (kpathsea kpse, string elt) elt = tname; free(wtname); } -#endif +#endif /* _WIN32 */ /* Normalize ELT before looking for a cached value. */ i = kpathsea_normalize_path (kpse, elt); /* If we've already cached the answer for ELT, return it. */ ret = cached (kpse, elt); +#ifdef _WIN32 + if (ret) { + if (tname) free (tname); + return ret; + } +#else if (ret) return ret; +#endif /* _WIN32 */ /* We're going to have a real directory list to return. */ ret = XTALLOC1 (str_llist_type); @@ -464,6 +474,10 @@ kpathsea_element_dirs (kpathsea kpse, string elt) } #endif /* KPSE_DEBUG */ +#ifdef _WIN32 + if (tname) free (tname); +#endif /* _WIN32 */ + return ret; } -- cgit v1.2.3