From da4ca4e02f59d8d69f9996bd8de2f20f72d1d5ff Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 23 May 2020 04:43:16 +0100 Subject: chore(3p/nix/libexpr): Minor readability improvements in eval/value --- third_party/nix/src/libexpr/attr-set.hh | 2 +- third_party/nix/src/libexpr/eval.cc | 4 ++-- third_party/nix/src/libexpr/eval.hh | 15 ++++----------- third_party/nix/src/libexpr/value.hh | 5 ----- 4 files changed, 7 insertions(+), 19 deletions(-) (limited to 'third_party') 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 SearchPath; /* Initialise the Boehm GC, if applicable. */ void initGC(); +typedef std::map, + traceable_allocator>> + 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, - traceable_allocator>> - FileParseCache; -#else - typedef std::map FileParseCache; -#endif FileParseCache fileParseCache; /* A cache from path names to values. */ -#if HAVE_BOEHMGC typedef std::map, traceable_allocator>> FileEvalCache; -#else - typedef std::map 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 > ValueVector; typedef std::map, gc_allocator > > ValueMap; -#else -typedef std::vector ValueVector; -typedef std::map ValueMap; -#endif } // namespace nix -- cgit 1.4.1