about summary refs log tree commit diff
path: root/third_party/nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-23T03·43+0100
committerVincent Ambo <tazjin@google.com>2020-05-23T05·18+0100
commitda4ca4e02f59d8d69f9996bd8de2f20f72d1d5ff (patch)
tree553fe5528a19aff727295a33a2911fd5bd267b74 /third_party/nix
parent92792264f78ce95c08fdd802110ddad7956c0758 (diff)
chore(3p/nix/libexpr): Minor readability improvements in eval/value r/820
Diffstat (limited to 'third_party/nix')
-rw-r--r--third_party/nix/src/libexpr/attr-set.hh2
-rw-r--r--third_party/nix/src/libexpr/eval.cc4
-rw-r--r--third_party/nix/src/libexpr/eval.hh15
-rw-r--r--third_party/nix/src/libexpr/value.hh5
4 files changed, 7 insertions, 19 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.hh b/third_party/nix/src/libexpr/attr-set.hh
index 6b68b4664a09..cdfe9e41d5af 100644
--- a/third_party/nix/src/libexpr/attr-set.hh
+++ b/third_party/nix/src/libexpr/attr-set.hh
@@ -21,7 +21,7 @@ struct Attr {
   Attr(Symbol name, Value* value, Pos* pos = &noPos)
       : name(name), value(value), pos(pos){};
   Attr() : pos(&noPos){};
-  bool operator<(const Attr& a) const { return name < a.name; }
+  bool operator<(const Attr& other) const { return name < other.name; }
 };
 
 // TODO: remove this, it only exists briefly while I get rid of the
diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc
index c654faa76cfa..b406854f4e20 100644
--- a/third_party/nix/src/libexpr/eval.cc
+++ b/third_party/nix/src/libexpr/eval.cc
@@ -815,8 +815,8 @@ void ExprAttrs::eval(EvalState& state, Env& env, Value& value) {
     size_t displ = 0;
     for (auto& attr : attrs) {
       Value* vAttr;
-      vAttr = attr.second.e->maybeThunk(state,
-                                          attr.second.inherited ? env : env2);
+      vAttr =
+          attr.second.e->maybeThunk(state, attr.second.inherited ? env : env2);
       env2.values[displ++] = vAttr;
       value.attrs->push_back(Attr(attr.first, vAttr, &attr.second.pos));
     }
diff --git a/third_party/nix/src/libexpr/eval.hh b/third_party/nix/src/libexpr/eval.hh
index 73e35c9b2ce9..03dd275edc4e 100644
--- a/third_party/nix/src/libexpr/eval.hh
+++ b/third_party/nix/src/libexpr/eval.hh
@@ -53,6 +53,10 @@ typedef std::list<SearchPathElem> SearchPath;
 /* Initialise the Boehm GC, if applicable. */
 void initGC();
 
+typedef std::map<Path, Expr*, std::less<Path>,
+                 traceable_allocator<std::pair<const Path, Expr*>>>
+    FileParseCache;
+
 class EvalState {
  public:
   SymbolTable symbols;
@@ -79,23 +83,12 @@ class EvalState {
   SrcToStore srcToStore;
 
   /* A cache from path names to parse trees. */
-#if HAVE_BOEHMGC
-  typedef std::map<Path, Expr*, std::less<Path>,
-                   traceable_allocator<std::pair<const Path, Expr*>>>
-      FileParseCache;
-#else
-  typedef std::map<Path, Expr*> FileParseCache;
-#endif
   FileParseCache fileParseCache;
 
   /* A cache from path names to values. */
-#if HAVE_BOEHMGC
   typedef std::map<Path, Value, std::less<Path>,
                    traceable_allocator<std::pair<const Path, Value>>>
       FileEvalCache;
-#else
-  typedef std::map<Path, Value> FileEvalCache;
-#endif
   FileEvalCache fileEvalCache;
 
   SearchPath searchPath;
diff --git a/third_party/nix/src/libexpr/value.hh b/third_party/nix/src/libexpr/value.hh
index 892c11220e42..1f20a440d933 100644
--- a/third_party/nix/src/libexpr/value.hh
+++ b/third_party/nix/src/libexpr/value.hh
@@ -244,14 +244,9 @@ void mkPath(Value& v, const char* s);
    not included. */
 size_t valueSize(Value& v);
 
-#if HAVE_BOEHMGC
 typedef std::vector<Value*, gc_allocator<Value*> > ValueVector;
 typedef std::map<Symbol, Value*, std::less<Symbol>,
                  gc_allocator<std::pair<const Symbol, Value*> > >
     ValueMap;
-#else
-typedef std::vector<Value*> ValueVector;
-typedef std::map<Symbol, Value*> ValueMap;
-#endif
 
 }  // namespace nix