diff options
author | Chris Robinson <[email protected]> | 2018-11-02 18:48:08 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-02 18:48:08 -0700 |
commit | 5482efc9214d180e1f67fc528f593098ad20a678 (patch) | |
tree | 8b5026cc349b46444019fe215fc8b01bf793582f /Alc/polymorphism.h | |
parent | a7dcc1c6d107e5c5401151c50c89e137f2bb0c0b (diff) |
Make the polymorphic allocators allocate cleared memory
Diffstat (limited to 'Alc/polymorphism.h')
-rw-r--r-- | Alc/polymorphism.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Alc/polymorphism.h b/Alc/polymorphism.h index bc0a5681..83d5585f 100644 --- a/Alc/polymorphism.h +++ b/Alc/polymorphism.h @@ -61,7 +61,7 @@ static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, a /* Defines the default functions used to (de)allocate a polymorphic object. */ #define DECLARE_DEFAULT_ALLOCATORS(T) \ -static void* T##_New(size_t size) { return al_malloc(16, size); } \ +static void* T##_New(size_t size) { return al_calloc(16, size); } \ static void T##_Delete(void *ptr) { al_free(ptr); } @@ -84,14 +84,12 @@ static void T##_Delete(void *ptr) { al_free(ptr); } _res = (T*)T##_New(sizeof(T)); \ if(_res) \ { \ - memset(_res, 0, sizeof(T)); \ T##_Construct(_res, EXTRACT_NEW_ARGS /* Allocate and construct an object, with no arguments. */ #define NEW_OBJ0(_res, T) do { \ _res = (T*)T##_New(sizeof(T)); \ if(_res) \ { \ - memset(_res, 0, sizeof(T)); \ T##_Construct(_res EXTRACT_NEW_ARGS /* Destructs and deallocate an object. */ |