texlive[49236] Build/source/texk/kpathsea/elt-dirs.c: support

commits+kakuto at tug.org commits+kakuto at tug.org
Fri Nov 23 23:39:44 CET 2018


Revision: 49236
          http://tug.org/svn/texlive?view=revision&revision=49236
Author:   kakuto
Date:     2018-11-23 23:39:44 +0100 (Fri, 23 Nov 2018)
Log Message:
-----------
support non-ascii values for variables (w32 only)

Modified Paths:
--------------
    trunk/Build/source/texk/kpathsea/elt-dirs.c

Modified: trunk/Build/source/texk/kpathsea/elt-dirs.c
===================================================================
--- trunk/Build/source/texk/kpathsea/elt-dirs.c	2018-11-23 22:10:44 UTC (rev 49235)
+++ trunk/Build/source/texk/kpathsea/elt-dirs.c	2018-11-23 22:39:44 UTC (rev 49236)
@@ -409,6 +409,11 @@
   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 @@
   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,7 +431,7 @@
     elt = tname;
     free(wtname);
   }
-#endif
+#endif /* _WIN32 */
 
   /* Normalize ELT before looking for a cached value.  */
   i = kpathsea_normalize_path (kpse, elt);
@@ -435,8 +438,15 @@
 
   /* 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 @@
     }
 #endif /* KPSE_DEBUG */
 
+#ifdef _WIN32
+  if (tname) free (tname);
+#endif /* _WIN32 */
+
   return ret;
 }
 




More information about the tex-live-commits mailing list