diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-12-12 10:43:40 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-12-12 10:43:40 +0000 |
commit | f8e86ec9cb8d2ae745356441baa359900a07858e (patch) | |
tree | f6d3d07e95764989f155b4b9d3b28e6403ac5cea /Build/source/texk/kpathsea | |
parent | 0e77cbef84f48fed9328df9d8b78b03166bfb90c (diff) |
kpathsea: Somewhat disentangle path search functions
git-svn-id: svn://tug.org/texlive/trunk@28512 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea')
-rw-r--r-- | Build/source/texk/kpathsea/ChangeLog | 11 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/db.c | 2 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/pathsearch.c | 49 | ||||
-rw-r--r-- | Build/source/texk/kpathsea/pathsearch.h | 14 |
4 files changed, 21 insertions, 55 deletions
diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 94d592e45d6..af229dd3000 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,14 @@ +2012-12-12 Peter Breitenlohner <peb@mppmu.mpg.de> + + Somewhat disentangle path search functions. + * db.c (kpathsea_init_db): + Directly call kpathsea_path_search_list_generic() + instead of the kpathsea_all_path_search_list() wrapper. + * pathsearch.c: Rename the static function search_list() into + the non-static kpathsea_path_search_list_generic() and drop + the former kpathsea_path_search_list_generic() wrapper. + * pathsearch.[ch]: Drop the now unused *_path_search_list(). + 2012-12-11 Peter Breitenlohner <peb@mppmu.mpg.de> Resolve some const related problems. diff --git a/Build/source/texk/kpathsea/db.c b/Build/source/texk/kpathsea/db.c index 843a1a27b8f..1b79a646a51 100644 --- a/Build/source/texk/kpathsea/db.c +++ b/Build/source/texk/kpathsea/db.c @@ -383,7 +383,7 @@ kpathsea_init_db (kpathsea kpse) assert (sizeof(DB_NAME) == sizeof(DB_NAME_LC)); db_path = kpathsea_init_format (kpse, kpse_db_format); - db_files = kpathsea_all_path_search_list (kpse, db_path, db_names); + db_files = kpathsea_path_search_list_generic (kpse, db_path, db_names, true, true); orig_db_files = db_files; /* Must do this after the path searching (which ends up calling diff --git a/Build/source/texk/kpathsea/pathsearch.c b/Build/source/texk/kpathsea/pathsearch.c index b98582c4e92..cd19415a1b2 100644 --- a/Build/source/texk/kpathsea/pathsearch.c +++ b/Build/source/texk/kpathsea/pathsearch.c @@ -1,6 +1,6 @@ /* pathsearch.c: look up a filename in a path. - Copyright 1993, 1994, 1995, 1997, 2007, 2009, 2010, 2011 Karl Berry. + Copyright 1993, 1994, 1995, 1997, 2007, 2009-2012 Karl Berry. Copyright 1997-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -405,9 +405,11 @@ search (kpathsea kpse, const_string path, const_string original_name, Always return a list; if no files are found, the list will contain just NULL. If ALL is true, the list will be terminated with NULL. */ -static string * -search_list (kpathsea kpse, const_string path, const_string* names, - boolean must_exist, boolean all) + +string * +kpathsea_path_search_list_generic (kpathsea kpse, + const_string path, const_string* names, + boolean must_exist, boolean all) { str_list_type ret_list; const_string* namep; @@ -561,7 +563,7 @@ search_list (kpathsea kpse, const_string path, const_string* names, /* Search PATH for the first NAME according to MUST_EXIST. */ string -kpathsea_path_search (kpathsea kpse, const_string path, const_string name, +kpathsea_path_search (kpathsea kpse, const_string path, const_string name, boolean must_exist) { string *ret_list = search (kpse, path, name, must_exist, false); @@ -570,51 +572,16 @@ kpathsea_path_search (kpathsea kpse, const_string path, const_string name, return ret; } -/* Many inputs, return (more or less indeterminate) one matching string. */ - -string -kpathsea_path_search_list (kpathsea kpse, const_string path, - const_string* names, boolean must_exist) -{ - string *ret_list = kpathsea_path_search_list_generic (kpse, path, names, - must_exist, false); - string ret = *ret_list; - free (ret_list); - return ret; -} - /* Search PATH for all files named NAME. Might have been better not to assert `must_exist' here, but it's too late to change. */ string * -kpathsea_all_path_search (kpathsea kpse, const_string path, const_string name) +kpathsea_all_path_search (kpathsea kpse, const_string path, const_string name) { string *ret = search (kpse, path, name, true, true); return ret; } - -/* Many inputs, return list, allow specifying MUST_EXIST and ALL. */ - -string * -kpathsea_path_search_list_generic (kpathsea kpse, - const_string path, const_string* names, - boolean must_exist, boolean all) -{ - string *ret = search_list (kpse, path, names, must_exist, all); - return ret; -} - - -/* Many inputs, return list, MUST_EXIST and ALL always true. */ - -string * -kpathsea_all_path_search_list (kpathsea kpse, const_string path, - const_string* names) -{ - return kpathsea_path_search_list_generic (kpse, path, names, true, true); -} - #if defined (KPSE_COMPAT_API) string diff --git a/Build/source/texk/kpathsea/pathsearch.h b/Build/source/texk/kpathsea/pathsearch.h index 54a1f4f95a7..5cac02666d0 100644 --- a/Build/source/texk/kpathsea/pathsearch.h +++ b/Build/source/texk/kpathsea/pathsearch.h @@ -1,6 +1,6 @@ /* pathsearch.h: mostly-generic path searching. - Copyright 1993, 1994, 1996, 1997, 2007, 2008, 2009, 2011 Karl Berry. + Copyright 1993, 1994, 1996, 1997, 2007, 2008, 2009, 2011, 2012 Karl Berry. Copyright 1999-2005 Olaf Weber. This library is free software; you can redistribute it and/or @@ -82,14 +82,6 @@ extern str_llist_type *kpathsea_element_dirs (kpathsea kpse, extern KPSEDLL string kpathsea_path_search (kpathsea kpse, const_string path, const_string name, boolean must_exist); -#ifdef MAKE_KPSE_DLL /* libkpathsea internal only */ - -/* Like `kpathsea_path_search', except look for a list of NAMES. */ -extern string kpathsea_path_search_list - (kpathsea kpse, const_string path, const_string* names, boolean must_exist); - -#endif /* MAKE_KPSE_DLL */ - /* Like `kpathsea_path_search' with MUST_EXIST true, but always return all matches in a NULL-terminated list. */ extern KPSEDLL string *kpathsea_all_path_search @@ -102,10 +94,6 @@ extern KPSEDLL string *kpathsea_all_path_search extern string *kpathsea_path_search_list_generic (kpathsea kpse, const_string path, const_string* names, boolean must_exist, boolean all); -/* Search for any of NAMES, with MUST_EXIST and ALL true. */ -extern string *kpathsea_all_path_search_list - (kpathsea kpse, const_string path, const_string* names); - #endif /* MAKE_KPSE_DLL */ #if defined(KPSE_COMPAT_API) |