Abstracted functions pertaining to memory managment.
More...
|
#define | ruFree(p) ruMacStart { if(p) { free((void*)p); p = NULL; } } ruMacEnd |
| Frees given resource and sets paramater to NULL. More...
|
|
#define | ruReplace(p, n) ruMacStart { if(p) { free((void*)p); } p = n; } ruMacEnd |
| Frees given resource and set paramater to new value. More...
|
|
#define | ruMalloc0(count, ctype) (ctype*) ruMallocSize((rusize)(count), sizeof(ctype)); |
| Allocate and zero requested memory. More...
|
|
#define | ruRealloc(buf, count, ctype) (ctype*) ruReallocSize(buf, count, sizeof(ctype)) |
| Reallocate requested memory without zeroing. More...
|
|
Abstracted functions pertaining to memory managment.
◆ ruFree
#define ruFree |
( |
|
p | ) |
ruMacStart { if(p) { free((void*)p); p = NULL; } } ruMacEnd |
Frees given resource and sets paramater to NULL.
- Parameters
-
p | resource to be freed and NULLed if not NULL already |
◆ ruMalloc0
Allocate and zero requested memory.
- Parameters
-
count | Number of elements to allocate |
ctype | The type of element to allocate. This will be feed to sizeof(). |
- Returns
- Guarateed to return the requested memory block casted to (*ctype) or the process will terminate.
◆ ruRealloc
#define ruRealloc |
( |
|
buf, |
|
|
|
count, |
|
|
|
ctype |
|
) |
| (ctype*) ruReallocSize(buf, count, sizeof(ctype)) |
Reallocate requested memory without zeroing.
- Parameters
-
buf | The initial buffer to extend or reallocated. |
count | Number of elements to allocate. |
ctype | The type of element to allocate. This will be feed to sizeof(). |
- Returns
- Guarateed to return the requested memory block casted to (*ctype) or the process will terminate.
◆ ruReplace
#define ruReplace |
( |
|
p, |
|
|
|
n |
|
) |
| ruMacStart { if(p) { free((void*)p); } p = n; } ruMacEnd |
Frees given resource and set paramater to new value.
- Parameters
-
p | resource to be freed before new value is assigned |
n | new value to be assigned to freed resource |
◆ ruClearFunc
typedef ptr(* ruClearFunc) (ptr o) |
Signature of a generic free function returning NULL.
- Parameters
-
o | object to free. Function should insure it's not NULL before freeing |
◆ ruFreeFunc
typedef void(* ruFreeFunc) (ptr o) |
Signature of a generic free function.
- Parameters
-
o | object to free. Function should insure it's not NULL before freeing |
◆ ruClear()
Frees given resource if set and returns NULL.
- Parameters
-
o | resource to be freed and if not NULL already |
- Returns
- NULL
◆ ruMallocSize()
Allocate and zero requested memory.
- Parameters
-
count | Number of elements to allocate. |
ofsize | The size of each element to allocate. |
- Returns
- Guarateed to return the requested memory block or the process will terminate.
◆ ruMemDup()
Returns a copy of the given memory block.
- Parameters
-
buf | The memory area to duplicate. |
size | number of bytes to duplicate. |
- Returns
- Guarateed to return the requested memory block or the process will terminate.
◆ ruReallocSize()
Reallocate requested memory without zeroing.
- Parameters
-
buf | The initial buffer to extend or reallocated. |
count | Number of elements to allocate. |
ofsize | The size of each element to allocate. |
- Returns
- Guarateed to return the requested memory block or the process will terminate.