diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-04T13·28+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-04T13·28+0100 |
commit | c10c61449f954702ae6d8092120321744acd82ff (patch) | |
tree | 40c161c42301acdfbfd7786638293951c5baf54d /src/libexpr/eval.hh | |
parent | 4f7824c58ee0420c5679be6f0a9591f59edf410f (diff) |
Eliminate the "store" global variable
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r-- | src/libexpr/eval.hh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 2d7b7bcdcb62..a4286ce1f065 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -16,6 +16,7 @@ namespace nix { +class StoreAPI; class EvalState; @@ -82,6 +83,8 @@ public: Value vEmptySet; + const ref<StoreAPI> store; + private: SrcToStore srcToStore; @@ -97,7 +100,7 @@ private: public: - EvalState(const Strings & _searchPath); + EvalState(const Strings & _searchPath, ref<StoreAPI> store); ~EvalState(); void addToSearchPath(const string & s, bool warn = false); @@ -240,6 +243,8 @@ public: /* Print statistics. */ void printStats(); + void realiseContext(const PathSet & context); + private: unsigned long nrEnvs = 0; @@ -290,7 +295,4 @@ struct InvalidPathError : EvalError #endif }; -/* Realise all paths in `context' */ -void realiseContext(const PathSet & context); - } |