From 1763e7d3bcbdf37f2e7ad4428d2c8ec2a93b48e3 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 20 Mar 2022 14:48:44 -0700 Subject: [PATCH] Remove some dead code These functions were unused. --- src/common.cpp | 5 ----- src/common.h | 3 --- src/parser.cpp | 7 ------- src/parser.h | 3 --- src/tokenizer.cpp | 10 ---------- src/tokenizer.h | 7 +------ 6 files changed, 1 insertion(+), 34 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index afcbb47c3..4b5924c5c 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -1621,11 +1621,6 @@ bool unescape_string(const wcstring &input, wcstring *output, unescape_flags_t e return unescape_string(input.c_str(), input.size(), output, escape_special, style); } -[[gnu::noinline]] void bugreport() { - FLOG(error, _(L"This is a bug. Break on 'bugreport' to debug.")); - FLOG(error, _(L"If you can reproduce it, please report: "), PACKAGE_BUGREPORT, L'.'); -} - wcstring format_size(long long sz) { wcstring result; const wchar_t *sz_name[] = {L"kB", L"MB", L"GB", L"TB", L"PB", L"EB", L"ZB", L"YB", nullptr}; diff --git a/src/common.h b/src/common.h index 178e339a1..808e939cc 100644 --- a/src/common.h +++ b/src/common.h @@ -519,9 +519,6 @@ bool unescape_string(const wcstring &input, wcstring *output, unescape_flags_t e /// Write the given paragraph of output, redoing linebreaks to fit \p termsize. wcstring reformat_for_screen(const wcstring &msg, const termsize_t &termsize); -/// Print a short message about how to file a bug report to stderr. -void bugreport(); - /// Return the number of seconds from the UNIX epoch, with subsecond precision. This function uses /// the gettimeofday function and will have the same precision as that function. using timepoint_t = double; diff --git a/src/parser.cpp b/src/parser.cpp index 8eb1085b4..2cb529b88 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -543,13 +543,6 @@ const job_t *parser_t::job_with_id(job_id_t id) const { return nullptr; } -const job_t *parser_t::job_with_internal_id(internal_job_id_t id) const { - for (const auto &job : job_list) { - if (job->internal_job_id == id) return job.get(); - } - return nullptr; -} - job_t *parser_t::job_get_from_pid(pid_t pid) const { for (const auto &job : jobs()) { for (const process_ptr_t &p : job->processes) { diff --git a/src/parser.h b/src/parser.h index 46811cf67..e0a182d48 100644 --- a/src/parser.h +++ b/src/parser.h @@ -398,9 +398,6 @@ class parser_t : public std::enable_shared_from_this { /// Return the job with the specified job id. If id is 0 or less, return the last job used. const job_t *job_with_id(job_id_t job_id) const; - /// Return the job with the specified internal job id. - const job_t *job_with_internal_id(internal_job_id_t job_id) const; - /// Returns the job with the given pid. job_t *job_get_from_pid(pid_t pid) const; diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 861c57f61..f7d957622 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -686,16 +686,6 @@ bool is_token_delimiter(wchar_t c, bool is_first, maybe_t next) { return c == L'(' || !tok_is_string_character(c, is_first, next); } -wcstring tok_first(const wcstring &str) { - tokenizer_t t(str.c_str(), 0); - if (auto token = t.next()) { - if (token->type == token_type_t::string) { - return t.text_of(*token); - } - } - return {}; -} - wcstring tok_command(const wcstring &str) { tokenizer_t t(str.c_str(), 0); while (auto token = t.next()) { diff --git a/src/tokenizer.h b/src/tokenizer.h index fccff61db..98fd573d4 100644 --- a/src/tokenizer.h +++ b/src/tokenizer.h @@ -136,12 +136,7 @@ class tokenizer_t : noncopyable_t { /// Tests if this character can delimit tokens. bool is_token_delimiter(wchar_t c, bool is_first, maybe_t next); -/// Returns only the first token from the specified string. This is a convenience function, used to -/// retrieve the first token of a string. This can be useful for error messages, etc. On failure, -/// returns the empty string. -wcstring tok_first(const wcstring &str); - -/// Like to tok_first, but skip variable assignments like A=B. +/// \return the first token from the string, skipping variable assignments like A=B. wcstring tok_command(const wcstring &str); /// Struct wrapping up a parsed pipe or redirection.