diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-24T00·36+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-24T01·13+0100 |
commit | 06d7b4aebd9e4a1a87f77fe59a8c08392318be5d (patch) | |
tree | 264bfbef18b5b93596d6eb805fc9e5647ddadb4b /third_party/nix/src/nix-channel/nix-channel.cc | |
parent | 10481d25861f1c25b53cfbd8119199ef2e918f9f (diff) |
refactor(3p/nix/libutil): Replace chomp() with absl::strings r/835
Diffstat (limited to 'third_party/nix/src/nix-channel/nix-channel.cc')
-rw-r--r-- | third_party/nix/src/nix-channel/nix-channel.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/third_party/nix/src/nix-channel/nix-channel.cc b/third_party/nix/src/nix-channel/nix-channel.cc index 00305151747a..1a094f8cdb35 100644 --- a/third_party/nix/src/nix-channel/nix-channel.cc +++ b/third_party/nix/src/nix-channel/nix-channel.cc @@ -1,5 +1,6 @@ #include <regex> +#include <absl/strings/ascii.h> #include <fcntl.h> #include <pwd.h> @@ -25,7 +26,7 @@ static void readChannels() { for (const auto& line : tokenizeString<std::vector<string>>(channelsFile, "\n")) { - chomp(line); + absl::StripTrailingAsciiWhitespace(line); if (std::regex_search(line, std::regex("^\\s*\\#"))) { continue; } @@ -99,7 +100,7 @@ static void update(const StringSet& channelNames) { auto dl = getDownloader(); auto result = dl->downloadCached(store, request); auto filename = result.path; - url = chomp(result.effectiveUri); + url = absl::StripTrailingAsciiWhitespace(result.effectiveUri); // If the URL contains a version number, append it to the name // attribute (so that "nix-env -q" on the channels profile @@ -136,7 +137,7 @@ static void update(const StringSet& channelNames) { CachedDownloadRequest(url + "/nixexprs.tar.bz2")) .path; } - chomp(filename); + absl::StripTrailingAsciiWhitespace(filename); } // Regardless of where it came from, add the expression representing this |