minor allocator changes

This commit is contained in:
2020-02-05 22:34:48 +04:00
parent d52b92b8dc
commit c4376721ad
2 changed files with 3 additions and 4 deletions
-1
View File
@@ -11,7 +11,6 @@
#include <string.h> #include <string.h>
#include "allocator.h" #include "allocator.h"
#include "common.h"
void heap_free(pst_allocator* alloc, void* buff) void heap_free(pst_allocator* alloc, void* buff)
{ {
+3 -3
View File
@@ -16,15 +16,15 @@
#define CAT(a, ...) CAT2(a, __VA_ARGS__) #define CAT(a, ...) CAT2(a, __VA_ARGS__)
#define CAT2(a, ...) a ## __VA_ARGS__ #define CAT2(a, ...) a ## __VA_ARGS__
// declaration with initialization and parameters of initialization // declaration and initialization with parameters
#define pst_decl(TYPE, NAME, ...) \ #define pst_decl(TYPE, NAME, ...) \
TYPE NAME; CAT2(TYPE, _init) (&NAME, __VA_ARGS__); TYPE NAME; CAT2(TYPE, _init) (&NAME, __VA_ARGS__);
// declaration with initialization // declaration and initialization without parameters
#define pst_decl0(TYPE, NAME) \ #define pst_decl0(TYPE, NAME) \
TYPE NAME; CAT2(TYPE, _init) (&NAME); TYPE NAME; CAT2(TYPE, _init) (&NAME);
// allocation with initialization // allocation and initialization with parameters
#define pst_new(TYPE, NAME, ...) \ #define pst_new(TYPE, NAME, ...) \
TYPE* NAME; NAME = CAT2(TYPE, _new) (__VA_ARGS__); TYPE* NAME; NAME = CAT2(TYPE, _new) (__VA_ARGS__);