diff options
author | Max Kellermann <max@duempel.org> | 2014-01-07 23:33:46 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-07 23:35:18 +0100 |
commit | 27ca0db7a6143d2e479ff1ae52ec7c349ab1d4f2 (patch) | |
tree | 3f200069ab73baa09898fe1f242c6fd85396e2ba /src/util/VarSize.hxx | |
parent | 49f34fbf6861f10dbf9eb7549177888394926ff9 (diff) |
util/Alloc: new library replacing GLib's g_malloc()
Diffstat (limited to 'src/util/VarSize.hxx')
-rw-r--r-- | src/util/VarSize.hxx | 7 |
1 files changed, 3 insertions, 4 deletions
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 <type_traits> #include <utility> #include <new> -#include <glib.h> - /** * 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>(args)...); @@ -78,7 +77,7 @@ DeleteVarSize(T *instance) instance->T::~T(); /* free memory */ - g_free(instance); + free(instance); } #endif |