refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil
Uses the equivalent absl::StartsWith and absl::EndsWith functions instead.
This commit is contained in:
parent
8cf1322a6f
commit
b99b368d17
21 changed files with 69 additions and 57 deletions
9
third_party/nix/src/libutil/util.cc
vendored
9
third_party/nix/src/libutil/util.cc
vendored
|
|
@ -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) {
|
||||
|
|
|
|||
6
third_party/nix/src/libutil/util.hh
vendored
6
third_party/nix/src/libutil/util.hh
vendored
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue