aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval-inline.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-06-11 15:58:19 +0200
committerEelco Dolstra <edolstra@gmail.com>2018-06-12 17:49:51 +0200
commit6ad0a2f749b4db6b24e8b86625883b0b43ad7ba1 (patch)
tree04c75b659349401964509eefd323d5967677fbe1 /src/libexpr/eval-inline.hh
parent169e1478d88bd1af5109705553c7f6b756bb4ec4 (diff)
Remove duplicate definition of allocBytes()
Diffstat (limited to 'src/libexpr/eval-inline.hh')
-rw-r--r--src/libexpr/eval-inline.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh
index 8cc50e561..ad172c37c 100644
--- a/src/libexpr/eval-inline.hh
+++ b/src/libexpr/eval-inline.hh
@@ -78,4 +78,18 @@ inline void EvalState::forceList(Value & v, const Pos & pos)
throwTypeError("value is %1% while a list was expected, at %2%", v, pos);
}
+/* Note: Various places expect the allocated memory to be zeroed. */
+inline void * allocBytes(size_t n)
+{
+ void * p;
+#if HAVE_BOEHMGC
+ p = GC_malloc(n);
+#else
+ p = calloc(n, 1);
+#endif
+ if (!p) throw std::bad_alloc();
+ return p;
+}
+
+
}