From 729cc852b825bf3b2ff59b8218624bce71074fbf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 15 Jan 2008 17:31:20 +0000 Subject: call kpse_make_tex when the first element is NULL, now that we return a list git-svn-id: svn://tug.org/texlive/trunk@6240 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 3 +++ Build/source/texk/kpathsea/tex-file.c | 16 +++++++--------- Build/source/texk/kpathsea/variable.c | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 866c8a1b7bf..b3264d6895e 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,6 +1,9 @@ 2008-01-15 Karl Berry * variable.c (kpse_var_value): only free if new memory. + + * tex-file.c (kpse_find_file_generic): call kpse_make_tex if the + first element of the list is NULL, not the list itself. 2008-01-14 Karl Berry diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index e040e33eb74..db8079a5af6 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -810,14 +810,14 @@ kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format, for (ext = FMT_INFO.suffix; *ext; ext++) { string name_with_suffix = concat (name, *ext); target[count++] = name_with_suffix; - XRETALLOC(target, count+1, const_string); + XRETALLOC (target, count+1, const_string); if (use_fontmaps && (mapped_names = kpse_fontmap_lookup (name_with_suffix)) != NULL) { /* FIXME: we leak mapped_names and its elements, some of the time */ while ((mapped_name = *mapped_names++) != NULL) { target[count++] = xstrdup (mapped_name); - XRETALLOC(target, count+1, const_string); + XRETALLOC (target, count+1, const_string); } } } @@ -826,12 +826,12 @@ kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format, searches are allowed or the name already includes a suffix. */ if (name_has_suffix_already || !FMT_INFO.suffix_search_only) { target[count++] = xstrdup (name); - XRETALLOC(target, count+1, const_string); + XRETALLOC (target, count+1, const_string); if (use_fontmaps && (mapped_names = kpse_fontmap_lookup (name)) != NULL) { /* FIXME: we leak mapped_names and its elements, some of the time */ while ((mapped_name = *mapped_names++) != NULL) { target[count++] = xstrdup (mapped_name); - XRETALLOC(target, count+1, const_string); + XRETALLOC (target, count+1, const_string); } } } @@ -846,10 +846,8 @@ kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format, free ((void *) target[count]); count = 0; /* We look for a subset of the previous set of names, so the - * target array is large enough. In particular, we don't pound - * the disk for alternate names from the fontmaps. Perhaps we - * should? - */ + target array is large enough. In particular, we don't pound + the disk for alternate names from the fontmaps. */ if (!name_has_suffix_already && FMT_INFO.suffix_search_only) { for (ext = FMT_INFO.suffix; *ext; ext++) target[count++] = concat (name, *ext); @@ -868,7 +866,7 @@ kpse_find_file_generic P4C(const_string, name, kpse_file_format_type, format, /* If nothing was found, call mktex* to create a missing file. Since this returns a single string, morph it into a list. */ - if (!ret && must_exist) { + if (! *ret && must_exist) { ret = XTALLOC (2, string); ret[0] = kpse_make_tex (format, name); if (ret[0]) { diff --git a/Build/source/texk/kpathsea/variable.c b/Build/source/texk/kpathsea/variable.c index 7632f576c70..07881f773d3 100644 --- a/Build/source/texk/kpathsea/variable.c +++ b/Build/source/texk/kpathsea/variable.c @@ -61,9 +61,9 @@ kpse_var_value P1C(const_string, var) worry about doing the ~ expansion. */ if (ret) { string tmp = kpse_var_expand (ret); - if (tmp != ret) { - free (ret); - } + /* We don't want to free the previous value of ret here; apparently + it's used later, somewhere, somehow. (The end result was a crash + when making tex.fmt.) Sigh. */ ret = kpse_tilde_expand (tmp); if (ret != tmp) { free (tmp); -- cgit v1.2.3