mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Add a few more aliases
This commit is contained in:
parent
589d8f1f2b
commit
2f4a7a8301
3 changed files with 7 additions and 10 deletions
|
@ -57,9 +57,7 @@ enum class ProcessLineResult {
|
|||
struct NixRepl
|
||||
: AbstractNixRepl
|
||||
, detail::ReplCompleterMixin
|
||||
#if HAVE_BOEHMGC
|
||||
, gc
|
||||
#endif
|
||||
{
|
||||
size_t debugTraceIndex;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue