1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-09-26 11:50:05 +00:00

Refactored VLAs to support macrohard

This commit is contained in:
2022-03-14 12:06:32 -05:00
parent 6a5afb18a0
commit cb9823d21c
2 changed files with 15 additions and 2 deletions

View File

@@ -5,6 +5,16 @@
#define GROW_FACTOR 2
/* microsoft strikes again with their lack of support for VLAs */
#if _MSC_VER
#define VLA(type, var, sz) type var = laikaM_malloc(sizeof(type)*sz);
#define ENDVLA(var) laikaM_free(var);
#else
#define VLA(type, var, sz) type var[sz];
/* stubbed */
#define ENDVLA(var)
#endif
#define laikaM_malloc(sz) laikaM_realloc(NULL, sz)
#define laikaM_free(buf) laikaM_realloc(buf, 0)