Mercurial > octave
changeset 21884:e8a8cb1a7258
eliminate unused parameter in kpse functions
* kpse.cc, kpse.h (path_search, search, kpse_path_search,
path_find_first_of, find_first_of, kpse_path_find_first_of):
Eliminate unused parameter, MUST_EXIST.
* kpse.cc, pathsearch.cc: Change all callers.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 13 Jun 2016 10:55:52 -0400 |
parents | 02add2f597a1 |
children | 0806871e3e1e |
files | liboctave/util/kpse.cc liboctave/util/kpse.h liboctave/util/pathsearch.cc |
diffstat | 3 files changed, 20 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/util/kpse.cc Mon Jun 13 10:49:29 2016 -0400 +++ b/liboctave/util/kpse.cc Mon Jun 13 10:55:52 2016 -0400 @@ -340,8 +340,7 @@ return the first file found. Otherwise, search all elements of PATH. */ static std::list<std::string> -path_search (const std::string& path, const std::string& name, - bool /* must_exist */, bool all) +path_search (const std::string& path, const std::string& name, bool all) { std::list<std::string> ret_list; bool done = false; @@ -412,7 +411,7 @@ static std::list<std::string> search (const std::string& path, const std::string& original_name, - bool must_exist, bool all) + bool all) { std::list<std::string> ret_list; bool absolute_p; @@ -426,13 +425,13 @@ if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) std::cerr << "kdebug: start search (file=" << name - << ", must_exist=" << must_exist << ", find_all=" << all << ", path=" << path << ")." << std::endl; /* Find the file(s). */ - ret_list = absolute_p ? absolute_search (name) - : path_search (path, name, must_exist, all); + ret_list = (absolute_p + ? absolute_search (name) + : path_search (path, name, all)); /* The very first search is for texmf.cnf. We can't log that, since we want to allow setting TEXMFLOG in texmf.cnf. */ @@ -472,10 +471,9 @@ In any case, return the complete filename if found, otherwise NULL. */ std::string -kpse_path_search (const std::string& path, const std::string& name, - bool must_exist) +kpse_path_search (const std::string& path, const std::string& name) { - std::list<std::string> ret_list = search (path, name, must_exist, false); + std::list<std::string> ret_list = search (path, name, false); return ret_list.empty () ? "" : ret_list.front (); } @@ -486,7 +484,7 @@ std::list<std::string> kpse_all_path_search (const std::string& path, const std::string& name) { - return search (path, name, true, true); + return search (path, name, true); } /* This is the hard case -- look in each element of PATH for each @@ -495,8 +493,7 @@ std::list<std::string> path_find_first_of (const std::string& path, - const std::list<std::string>& names, - bool /* must_exist */, bool all) + const std::list<std::string>& names, bool all) { std::list<std::string> ret_list; bool done = false; @@ -567,13 +564,13 @@ static std::list<std::string> find_first_of (const std::string& path, const std::list<std::string>& names, - bool must_exist, bool all) + bool all) { std::list<std::string> ret_list; if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) { - std::cerr << "kdebug: start find_first_of (("; + std::cerr << "kdebug: start find_first_of ("; for (auto p = names.cbegin (); p != names.cend (); p++) { @@ -583,8 +580,7 @@ std::cerr << ", " << *p; } - std::cerr << "), path=" << path << ", must_exist=" - << must_exist << "." << std::endl; + std::cerr << "), path=" << path << "." << std::endl; } for (const auto &name : names) @@ -603,7 +599,7 @@ } /* Find the file. */ - ret_list = path_find_first_of (path, names, must_exist, all); + ret_list = path_find_first_of (path, names, all); /* The very first search is for texmf.cnf. We can't log that, since we want to allow setting TEXMFLOG in texmf.cnf. */ @@ -648,11 +644,9 @@ std::string kpse_path_find_first_of (const std::string& path, - const std::list<std::string>& names, - bool must_exist) + const std::list<std::string>& names) { - std::list<std::string> ret_list - = find_first_of (path, names, must_exist, false); + std::list<std::string> ret_list = find_first_of (path, names, false); return ret_list.empty () ? "" : ret_list.front (); } @@ -668,7 +662,7 @@ kpse_all_path_find_first_of (const std::string& path, const std::list<std::string>& names) { - return find_first_of (path, names, true, true); + return find_first_of (path, names, true); } /* If NAME has a leading ~ or ~user, Unix-style, expand it to the user's
--- a/liboctave/util/kpse.h Mon Jun 13 10:49:29 2016 -0400 +++ b/liboctave/util/kpse.h Mon Jun 13 10:55:52 2016 -0400 @@ -89,11 +89,9 @@ extern std::string kpse_path_find_first_of (const std::string& path, - const std::list<std::string>& names, - bool must_exist); + const std::list<std::string>& names); extern std::string -kpse_path_search (const std::string& path, const std::string& name, - bool must_exist); +kpse_path_search (const std::string& path, const std::string& name); #endif
--- a/liboctave/util/pathsearch.cc Mon Jun 13 10:49:29 2016 -0400 +++ b/liboctave/util/pathsearch.cc Mon Jun 13 10:55:52 2016 -0400 @@ -90,7 +90,7 @@ std::string directory_path::find_first (const std::string& nm) { - return m_initialized ? kpse_path_search (m_expanded_path, nm, true) : ""; + return m_initialized ? kpse_path_search (m_expanded_path, nm) : ""; } std::list<std::string> @@ -105,7 +105,7 @@ directory_path::find_first_of (const std::list<std::string>& names) { return (m_initialized - ? kpse_path_find_first_of (m_expanded_path, names, true) : ""); + ? kpse_path_find_first_of (m_expanded_path, names) : ""); } std::list<std::string>