about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/download.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/download.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/download.cc')
-rw-r--r--third_party/nix/src/libstore/download.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/third_party/nix/src/libstore/download.cc b/third_party/nix/src/libstore/download.cc
index bebe0d1bf8..8b36063dab 100644
--- a/third_party/nix/src/libstore/download.cc
+++ b/third_party/nix/src/libstore/download.cc
@@ -1,6 +1,7 @@
 #include "download.hh"
 
 #include <absl/strings/ascii.h>
+#include <absl/strings/match.h>
 #include <absl/strings/numbers.h>
 
 #include "archive.hh"
@@ -653,8 +654,8 @@ struct CurlDownloader : public Downloader {
   }
 
   void enqueueItem(const std::shared_ptr<DownloadItem>& item) {
-    if (item->request.data && !hasPrefix(item->request.uri, "http://") &&
-        !hasPrefix(item->request.uri, "https://")) {
+    if (item->request.data && !absl::StartsWith(item->request.uri, "http://") &&
+        !absl::StartsWith(item->request.uri, "https://")) {
       throw nix::Error("uploading to '%s' is not supported", item->request.uri);
     }
 
@@ -690,7 +691,7 @@ struct CurlDownloader : public Downloader {
   void enqueueDownload(const DownloadRequest& request,
                        Callback<DownloadResult> callback) override {
     /* Ugly hack to support s3:// URIs. */
-    if (hasPrefix(request.uri, "s3://")) {
+    if (absl::StartsWith(request.uri, "s3://")) {
       // FIXME: do this on a worker thread
       try {
 #ifdef ENABLE_S3