1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 00:16:11 -04:00

Add a few more aliases

This commit is contained in:
Eelco Dolstra 2024-09-19 21:03:59 +02:00
parent 589d8f1f2b
commit 2f4a7a8301
3 changed files with 7 additions and 10 deletions

View file

@ -57,9 +57,7 @@ enum class ProcessLineResult {
struct NixRepl
: AbstractNixRepl
, detail::ReplCompleterMixin
#if HAVE_BOEHMGC
, gc
#endif
{
size_t debugTraceIndex;

View file

@ -13,12 +13,19 @@
#else
/* Some dummy aliases for Boehm GC definitions to reduce the number of
#ifdefs. */
template<typename T>
using traceable_allocator = std::allocator<T>;
template<typename T>
using gc_allocator = std::allocator<T>;
#define GC_MALLOC_ATOMIC std::malloc
#define GC_STRDUP std::strdup
struct gc { };
#endif
namespace nix {

View file

@ -47,11 +47,7 @@ namespace nix {
static char * allocString(size_t size)
{
char * t;
#if HAVE_BOEHMGC
t = (char *) GC_MALLOC_ATOMIC(size);
#else
t = (char *) malloc(size);
#endif
if (!t) throw std::bad_alloc();
return t;
}
@ -60,11 +56,7 @@ static char * allocString(size_t size)
static char * dupString(const char * s)
{
char * t;
#if HAVE_BOEHMGC
t = GC_STRDUP(s);
#else
t = strdup(s);
#endif
if (!t) throw std::bad_alloc();
return t;
}