Memory allocation macros [macros]
Memory allocation macros
These macros allow slightly simplified handling of memory.
sgs_Malloc( C, size ): allocates the memory (alias to sgs_Memory( C, NULL, size )).
sgs_Free( C, ptr ): frees the memory (alias to sgs_Memory( C, ptr, 0 )).
- sgs_Realloc: alias to sgs_Memory.
- The following macros expect that the variable sgs_Context* C is in the scope:
sgs_Alloc( what ): allocates enough memory to fit the specified type what;
sgs_Alloc_n( what, n ): allocates enough memory to fit n instances of the specified type what;
sgs_Alloc_a( what, app ): allocates enough memory to fit the specified type what and app more bytes;
sgs_Dealloc( ptr ): frees the memory.
- All of these functions, including sgs_Memory, work on the same heap, thus they are interchangeable.