sgs_Memory [function]
void sgs_Memory( sgs_Context* C, void* ptr, size_t size )
Allocates and frees memory, as specified in arguments.
- There are four possible cases that are handled by the function:
ptr
!= NULL, size
!= 0: ptr
is reallocated with new size, keeping as much data as possible, new block of memory is returned;
ptr
!= NULL, size
== 0: ptr
is freed, NULL is returned;
ptr
== NULL, size
!= 0: a new block of memory is allocated and returned;
ptr
== NULL, size
== 0: nothing is done, NULL is returned.