Introduce sstrndup wrapper.

This commit is contained in:
Michael Hofmann
2015-05-06 16:28:29 +02:00
parent 37bee99538
commit 0319bda1d4
4 changed files with 16 additions and 2 deletions

View File

@ -127,6 +127,13 @@ void *srealloc(void *ptr, size_t size);
*/
char *sstrdup(const char *str);
/**
* Safe-wrapper around strndup which exits if strndup returns NULL (meaning that
* there is no more memory available)
*
*/
char *sstrndup(const char *str, size_t size);
/**
* Safe-wrapper around asprintf which exits if it returns -1 (meaning that
* there is no more memory available)