summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-11-23 22:39:44 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2018-11-23 22:39:44 +0000
commit343568ad7841c2cd8e0d7fc4076056344db94357 (patch)
tree42f64e31e54ea1547848766b9712e41edca56698 /Build
parentc33975c4756b28e5aa1f4334e425587a65698d39 (diff)
support non-ascii values for variables (w32 only)
git-svn-id: svn://tug.org/texlive/trunk@49236 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/kpathsea/elt-dirs.c20
1 files changed, 17 insertions, 3 deletions
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;
}