util/VarSize: use plain malloc()
This commit is contained in:
parent
8e71130e8a
commit
635ec3ce37
@ -30,7 +30,6 @@
|
|||||||
#ifndef MPD_VAR_SIZE_HXX
|
#ifndef MPD_VAR_SIZE_HXX
|
||||||
#define MPD_VAR_SIZE_HXX
|
#define MPD_VAR_SIZE_HXX
|
||||||
|
|
||||||
#include "Alloc.hxx"
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@ -61,7 +60,9 @@ NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args)
|
|||||||
size_t size = sizeof(T) - declared_tail_size + real_tail_size;
|
size_t size = sizeof(T) - declared_tail_size + real_tail_size;
|
||||||
|
|
||||||
/* allocate memory */
|
/* allocate memory */
|
||||||
T *instance = (T *)xalloc(size);
|
T *instance = (T *)malloc(size);
|
||||||
|
if (instance == nullptr)
|
||||||
|
throw std::bad_alloc{};
|
||||||
|
|
||||||
/* call the constructor */
|
/* call the constructor */
|
||||||
new(instance) T(std::forward<Args>(args)...);
|
new(instance) T(std::forward<Args>(args)...);
|
||||||
|
Loading…
Reference in New Issue
Block a user