add a lumiera_realloc() function to the safeclib
This commit is contained in:
parent
0346e113e5
commit
38f2a9c6c9
2 changed files with 21 additions and 0 deletions
|
|
@ -51,6 +51,17 @@ lumiera_calloc (size_t n, size_t size)
|
|||
}
|
||||
|
||||
|
||||
void*
|
||||
lumiera_realloc (void* ptr, size_t size)
|
||||
{
|
||||
void* o = size ? realloc (ptr, size) : NULL;
|
||||
if (!o)
|
||||
LUMIERA_DIE (NO_MEMORY);
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
lumiera_strndup (const char* str, size_t len)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -50,6 +50,16 @@ void*
|
|||
lumiera_calloc (size_t n, size_t size);
|
||||
|
||||
|
||||
/**
|
||||
* Change the size of a memory block.
|
||||
* @param ptr pointer to the old memory block obtained by lumiera_malloc or lumiera_calloc
|
||||
* @param size new size of the block
|
||||
* @return address of new block
|
||||
*/
|
||||
void*
|
||||
lumiera_realloc (void* ptr, size_t size);
|
||||
|
||||
|
||||
/**
|
||||
* Free previously allocated memory.
|
||||
* @param mem pointer to the memory block obtained by lumiera_malloc or lumiera_calloc
|
||||
|
|
|
|||
Loading…
Reference in a new issue