about summary refs log tree commit diff
path: root/third_party/nix/src/nix-env
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/nix-env
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/nix-env')
-rw-r--r--third_party/nix/src/nix-env/nix-env.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/third_party/nix/src/nix-env/nix-env.cc b/third_party/nix/src/nix-env/nix-env.cc
index d17bde34f3cd..d25a4897467c 100644
--- a/third_party/nix/src/nix-env/nix-env.cc
+++ b/third_party/nix/src/nix-env/nix-env.cc
@@ -4,6 +4,7 @@
 #include <iostream>
 #include <sstream>
 
+#include <absl/strings/match.h>
 #include <absl/strings/numbers.h>
 #include <glog/logging.h>
 #include <sys/stat.h>
@@ -111,13 +112,13 @@ static void getAllExprs(EvalState& state, const Path& path, StringSet& attrs,
     }
 
     if (isNixExpr(path2, st) &&
-        (!S_ISREG(st.st_mode) || hasSuffix(path2, ".nix"))) {
+        (!S_ISREG(st.st_mode) || absl::EndsWith(path2, ".nix"))) {
       /* Strip off the `.nix' filename suffix (if applicable),
          otherwise the attribute cannot be selected with the
          `-A' option.  Useful if you want to stick a Nix
          expression directly in ~/.nix-defexpr. */
       std::string attrName = i;
-      if (hasSuffix(attrName, ".nix")) {
+      if (absl::EndsWith(attrName, ".nix")) {
         attrName = std::string(attrName, 0, attrName.size() - 4);
       }
       if (attrs.find(attrName) != attrs.end()) {