mirror of
https://github.com/NixOS/nix
synced 2025-06-28 01:11:15 +02:00
libexpr: Rely on Boehm returning zeroed memory in EvalState::allocEnv()
Boehm guarantees that memory returned by GC_malloc() is zeroed, so take advantage of that.
This commit is contained in:
parent
b8bed7da14
commit
0845cdf944
2 changed files with 5 additions and 5 deletions
|
@ -7,13 +7,14 @@
|
|||
namespace nix {
|
||||
|
||||
|
||||
/* Note: Various places expect the allocated memory to be zeroed. */
|
||||
static void * allocBytes(size_t n)
|
||||
{
|
||||
void * p;
|
||||
#if HAVE_BOEHMGC
|
||||
p = GC_malloc(n);
|
||||
#else
|
||||
p = malloc(n);
|
||||
p = calloc(n, 1);
|
||||
#endif
|
||||
if (!p) throw std::bad_alloc();
|
||||
return p;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue