summaryrefslogtreecommitdiff
path: root/src/util/VarSize.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/VarSize.hxx')
-rw-r--r--src/util/VarSize.hxx7
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