define pst_alloc & pst_free macro to use global allocator

This commit is contained in:
2020-02-01 17:57:43 +04:00
parent e27f0c5c18
commit 7c13dfa9e1
8 changed files with 50 additions and 46 deletions
+6
View File
@@ -20,6 +20,12 @@
extern pst_log logger; // logger for whole PST library
extern pst_allocator allocator; // custom allocator for PS library
#define pst_alloc(TYPE) (TYPE*)allocator.alloc(&allocator, sizeof(TYPE))
#define pst_free(NAME) allocator.free(&allocator, NAME)
#define pst_log(SEVERITY, FORMAT, ...) logger.log(&logger, SEVERITY, FORMAT, ##__VA_ARGS__)
char* pst_dup(const char* str);
typedef struct __pst_context {
// methods
void (*clean_print) (__pst_context* ctx);