From b99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 25 May 2020 02:19:01 +0100 Subject: refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil Uses the equivalent absl::StartsWith and absl::EndsWith functions instead. --- third_party/nix/src/libutil/util.cc | 9 --------- third_party/nix/src/libutil/util.hh | 6 ------ 2 files changed, 15 deletions(-) (limited to 'third_party/nix/src/libutil') diff --git a/third_party/nix/src/libutil/util.cc b/third_party/nix/src/libutil/util.cc index 8dca97af98a0..fb9c6bfd5270 100644 --- a/third_party/nix/src/libutil/util.cc +++ b/third_party/nix/src/libutil/util.cc @@ -1255,15 +1255,6 @@ bool statusOk(int status) { return WIFEXITED(status) && WEXITSTATUS(status) == 0; } -bool hasPrefix(const std::string& s, const std::string& prefix) { - return s.compare(0, prefix.size(), prefix) == 0; -} - -bool hasSuffix(const std::string& s, const std::string& suffix) { - return s.size() >= suffix.size() && - std::string(s, s.size() - suffix.size()) == suffix; -} - std::string toLower(const std::string& s) { std::string r(s); for (auto& c : r) { diff --git a/third_party/nix/src/libutil/util.hh b/third_party/nix/src/libutil/util.hh index 0f3752dfde5a..51d9979e1655 100644 --- a/third_party/nix/src/libutil/util.hh +++ b/third_party/nix/src/libutil/util.hh @@ -344,12 +344,6 @@ bool string2Float(const std::string& s, N& n) { return str && str.get() == EOF; } -/* Return true iff `s' starts with `prefix'. */ -bool hasPrefix(const std::string& s, const std::string& prefix); - -/* Return true iff `s' ends in `suffix'. */ -bool hasSuffix(const std::string& s, const std::string& suffix); - /* Convert a string to lower case. */ std::string toLower(const std::string& s); -- cgit 1.4.1