aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/value.hh
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-07-15 16:18:36 -0600
committerQyriad <qyriad@qyriad.me>2024-07-20 20:20:01 +0000
commita3361557e3f4a53b90ca5067e68ba9788df20928 (patch)
tree60899a6f30348b8b919c289e06b59fa644003b9d /src/libexpr/value.hh
parent0109368c3faf5516aeddde45e8dc3c33e7163838 (diff)
libexpr: refactor gc-agnostic helpers into one place
Change-Id: Icc4b367e4f670d47256f62a3a002cd248a5c2d3b
Diffstat (limited to 'src/libexpr/value.hh')
-rw-r--r--src/libexpr/value.hh18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh
index 5c57257be..c35f88f8d 100644
--- a/src/libexpr/value.hh
+++ b/src/libexpr/value.hh
@@ -4,6 +4,7 @@
#include <cassert>
#include <climits>
+#include "gc-alloc.hh"
#include "symbol-table.hh"
#include "value/context.hh"
#include "input-accessor.hh"
@@ -11,9 +12,6 @@
#include "print-options.hh"
#include "checked-arithmetic.hh"
-#if HAVE_BOEHMGC
-#include <gc/gc_allocator.h>
-#endif
#include <nlohmann/json_fwd.hpp>
namespace nix {
@@ -464,17 +462,9 @@ void Value::mkBlackhole()
thunk.expr = (Expr*) &eBlackHole;
}
-
-#if HAVE_BOEHMGC
-typedef std::vector<Value *, traceable_allocator<Value *>> ValueVector;
-typedef std::map<Symbol, Value *, std::less<Symbol>, traceable_allocator<std::pair<const Symbol, Value *>>> ValueMap;
-typedef std::map<Symbol, ValueVector, std::less<Symbol>, traceable_allocator<std::pair<const Symbol, ValueVector>>> ValueVectorMap;
-#else
-typedef std::vector<Value *> ValueVector;
-typedef std::map<Symbol, Value *> ValueMap;
-typedef std::map<Symbol, ValueVector> ValueVectorMap;
-#endif
-
+using ValueVector = GcVector<Value *>;
+using ValueMap = GcMap<Symbol, Value *>;
+using ValueVectorMap = std::map<Symbol, ValueVector>;
/**
* A value allocated in traceable memory.