From 27ca0db7a6143d2e479ff1ae52ec7c349ab1d4f2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 7 Jan 2014 23:33:46 +0100 Subject: util/Alloc: new library replacing GLib's g_malloc() --- src/util/VarSize.hxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/util/VarSize.hxx') diff --git a/src/util/VarSize.hxx b/src/util/VarSize.hxx index b1123b858..04f1bf580 100644 --- a/src/util/VarSize.hxx +++ b/src/util/VarSize.hxx @@ -30,14 +30,13 @@ #ifndef MPD_VAR_SIZE_HXX #define MPD_VAR_SIZE_HXX +#include "Alloc.hxx" #include "Compiler.h" #include #include #include -#include - /** * Allocate and construct a variable-size object. That is useful for * example when you want to store a variable-length string as the last @@ -61,7 +60,7 @@ NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args) size_t size = sizeof(T) - declared_tail_size + real_tail_size; /* allocate memory */ - T *instance = (T *)g_malloc(size); + T *instance = (T *)xalloc(size); /* call the constructor */ new(instance) T(std::forward(args)...); @@ -78,7 +77,7 @@ DeleteVarSize(T *instance) instance->T::~T(); /* free memory */ - g_free(instance); + free(instance); } #endif -- cgit v1.2.3