From a849488fd6c6ab60c6b927fd43e04691a2634f00 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Mon, 10 May 2010 09:48:04 +0000 Subject: kpathsea: more const git-svn-id: svn://tug.org/texlive/trunk@18187 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 10 ++++++++++ Build/source/texk/kpathsea/extend-fname.c | 6 +++--- Build/source/texk/kpathsea/fontmap.c | 20 ++++++-------------- Build/source/texk/kpathsea/fontmap.h | 6 +----- Build/source/texk/kpathsea/lib.h | 4 ++-- Build/source/texk/kpathsea/progname.c | 2 +- Build/source/texk/kpathsea/tex-file.c | 4 ++-- Build/source/texk/kpathsea/tex-glyph.c | 6 +++--- 8 files changed, 28 insertions(+), 30 deletions(-) diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index c53512adc51..ed4118b2ebc 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,13 @@ +2010-05-09 Peter Breitenlohner + + * progname.c (kpathsea_set_program_name): Drop superfluous cast. + + * extend-fname.c, lib.h: Change return type of extend_filename() + from 'string' to 'const_string'. + * fontmap.[ch]: Change return type of kpathsea_fontmap_lookup() + from 'string *' to 'const_string *', drop kpse_fontmap_lookup. + * tex-file.c (target_fontmaps), tex-glyph.c (try_fontmap): Adjust. + 2010-04-27 Manuel Pégourié-Gonnard * texmf.cnf: - s/pdf(lua(la)?tex)/dvi\1/ diff --git a/Build/source/texk/kpathsea/extend-fname.c b/Build/source/texk/kpathsea/extend-fname.c index b4a79eb297d..58b77ce4deb 100644 --- a/Build/source/texk/kpathsea/extend-fname.c +++ b/Build/source/texk/kpathsea/extend-fname.c @@ -21,13 +21,13 @@ /* We may or may not return NAME. It's up to the caller not to assume the return value is modifiable. */ -string +const_string extend_filename (const_string name, const_string default_suffix) { - string new_s; + const_string new_s; const_string suffix = find_suffix (name); new_s = suffix == NULL ? concat3 (name, ".", default_suffix) - : (string) name; + : name; return new_s; } diff --git a/Build/source/texk/kpathsea/fontmap.c b/Build/source/texk/kpathsea/fontmap.c index 756fe936399..1eeecde7d9c 100644 --- a/Build/source/texk/kpathsea/fontmap.c +++ b/Build/source/texk/kpathsea/fontmap.c @@ -168,31 +168,31 @@ read_all_maps (kpathsea kpse) /* Look up KEY in texfonts.map's; if it's not found, remove any suffix from KEY and try again. Create the map if necessary. */ -string * -kpathsea_fontmap_lookup (kpathsea kpse, const_string key) +const_string * +kpathsea_fontmap_lookup (kpathsea kpse, const_string key) { - string *ret; + const_string *ret; string suffix = find_suffix (key); if (kpse->map.size == 0) { read_all_maps (kpse); } - ret = hash_lookup (kpse->map, key); + ret = (const_string *) hash_lookup (kpse->map, key); if (!ret) { /* OK, the original KEY didn't work. Let's check for the KEY without an extension -- perhaps they gave foobar.tfm, but the mapping only defines `foobar'. */ if (suffix) { string base_key = remove_suffix (key); - ret = hash_lookup (kpse->map, base_key); + ret = (const_string *) hash_lookup (kpse->map, base_key); free (base_key); } } /* Append any original suffix. */ if (ret && suffix) { - string *elt; + const_string *elt; for (elt = ret; *elt; elt++) { *elt = extend_filename (*elt, suffix); } @@ -200,11 +200,3 @@ kpathsea_fontmap_lookup (kpathsea kpse, const_string key) return ret; } - -#if defined(KPSE_COMPAT_API) -string * -kpse_fontmap_lookup (const_string key) -{ - return kpathsea_fontmap_lookup(kpse_def, key); -} -#endif diff --git a/Build/source/texk/kpathsea/fontmap.h b/Build/source/texk/kpathsea/fontmap.h index 2f7e21fc3fd..c0a7f74b571 100644 --- a/Build/source/texk/kpathsea/fontmap.h +++ b/Build/source/texk/kpathsea/fontmap.h @@ -26,11 +26,7 @@ /* Look up KEY in all texfonts.map's in the glyph_format path, and return a null-terminated list of all matching entries, or NULL. */ -extern string *kpathsea_fontmap_lookup (kpathsea kpse, const_string key); - -#if defined (KPSE_COMPAT_API) -extern string *kpse_fontmap_lookup (const_string key); -#endif +extern const_string *kpathsea_fontmap_lookup (kpathsea kpse, const_string key); #endif /* MAKE_KPSE_DLL */ diff --git a/Build/source/texk/kpathsea/lib.h b/Build/source/texk/kpathsea/lib.h index d8936c01913..3dd1daffe70 100644 --- a/Build/source/texk/kpathsea/lib.h +++ b/Build/source/texk/kpathsea/lib.h @@ -169,8 +169,8 @@ extern KPSEDLL string make_prefix (string stem_prefix, string name); /* If NAME has a suffix, simply return it; otherwise, return `NAME.SUFFIX'. */ -extern KPSEDLL string extend_filename (const_string name, - const_string suffix); +extern KPSEDLL const_string extend_filename (const_string name, + const_string suffix); /* Call putenv with the string `VAR=VALUE' and abort on error. */ extern KPSEDLL void kpathsea_xputenv (kpathsea kpse, const_string var, diff --git a/Build/source/texk/kpathsea/progname.c b/Build/source/texk/kpathsea/progname.c index 0e19188a0b7..68b39badd6a 100644 --- a/Build/source/texk/kpathsea/progname.c +++ b/Build/source/texk/kpathsea/progname.c @@ -626,7 +626,7 @@ kpathsea_set_program_name (kpathsea kpse, const_string argv0, free (sdir_grandparent); kpse->invocation_short_name - = xstrdup ((string) xbasename (kpse->invocation_name)); + = xstrdup (xbasename (kpse->invocation_name)); if (progname) { kpse->program_name = xstrdup (progname); diff --git a/Build/source/texk/kpathsea/tex-file.c b/Build/source/texk/kpathsea/tex-file.c index 03f8a142b7e..6d02b7b4ee5 100644 --- a/Build/source/texk/kpathsea/tex-file.c +++ b/Build/source/texk/kpathsea/tex-file.c @@ -868,10 +868,10 @@ static void target_fontmaps (kpathsea kpse, string **target, unsigned *count, const_string name) { - string *mapped_names = kpathsea_fontmap_lookup (kpse, name); + const_string *mapped_names = kpathsea_fontmap_lookup (kpse, name); if (mapped_names != NULL) { - string mapped_name; + const_string mapped_name; /* We leak mapped_names and its elements, some of the time. */ while ((mapped_name = *mapped_names++) != NULL) { (*target)[(*count)] = xstrdup (mapped_name); diff --git a/Build/source/texk/kpathsea/tex-glyph.c b/Build/source/texk/kpathsea/tex-glyph.c index c9f480c73c5..8c97ccc44f6 100644 --- a/Build/source/texk/kpathsea/tex-glyph.c +++ b/Build/source/texk/kpathsea/tex-glyph.c @@ -152,14 +152,14 @@ try_fontmap (kpathsea kpse, string *fontname_ptr, unsigned dpi, kpse_file_format_type format, kpse_glyph_file_type *glyph_file) { - string *mapped_names; + const_string *mapped_names; string fontname = *fontname_ptr; string ret = NULL; mapped_names = kpathsea_fontmap_lookup (kpse, fontname); if (mapped_names) { - string mapped_name; - string first_name = *mapped_names; + const_string mapped_name; + const_string first_name = *mapped_names; while (!ret && (mapped_name = *mapped_names++)) { kpathsea_xputenv (kpse, "KPATHSEA_NAME", mapped_name); ret = try_resolution (kpse, mapped_name, dpi, format, glyph_file); -- cgit v1.2.3