about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/builtins/fetchurl.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T01·19+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T01·19+0100
commitb99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (patch)
tree1f76047dd027421dcf79cdf4804fa5ff1bb08b2b /third_party/nix/src/libstore/builtins/fetchurl.cc
parent8cf1322a6fd5ae282d8a09fdba634f27a1a88560 (diff)
refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil r/845
Uses the equivalent absl::StartsWith and absl::EndsWith functions
instead.
Diffstat (limited to 'third_party/nix/src/libstore/builtins/fetchurl.cc')
-rw-r--r--third_party/nix/src/libstore/builtins/fetchurl.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/third_party/nix/src/libstore/builtins/fetchurl.cc b/third_party/nix/src/libstore/builtins/fetchurl.cc
index 97260d2e5229..90814f6d7f0b 100644
--- a/third_party/nix/src/libstore/builtins/fetchurl.cc
+++ b/third_party/nix/src/libstore/builtins/fetchurl.cc
@@ -1,3 +1,4 @@
+#include <absl/strings/match.h>
 #include <glog/logging.h>
 
 #include "archive.hh"
@@ -41,7 +42,7 @@ void builtinFetchurl(const BasicDerivation& drv, const std::string& netrcData) {
       request.decompress = false;
 
       auto decompressor = makeDecompressionSink(
-          unpack && hasSuffix(mainUrl, ".xz") ? "xz" : "none", sink);
+          unpack && absl::EndsWith(mainUrl, ".xz") ? "xz" : "none", sink);
       downloader->download(std::move(request), *decompressor);
       decompressor->finish();
     });
@@ -61,7 +62,7 @@ void builtinFetchurl(const BasicDerivation& drv, const std::string& netrcData) {
   /* Try the hashed mirrors first. */
   if (getAttr("outputHashMode") == "flat")
     for (auto hashedMirror : settings.hashedMirrors.get()) try {
-        if (!hasSuffix(hashedMirror, "/")) {
+        if (!absl::EndsWith(hashedMirror, "/")) {
           hashedMirror += '/';
         }
         auto ht = parseHashType(getAttr("outputHashAlgo"));