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

@ -48,6 +48,13 @@ char *sstrdup(const char *str) {
return result;
}
char *sstrndup(const char *str, size_t size) {
char *result = strndup(str, size);
if (result == NULL)
err(EXIT_FAILURE, "strndup()");
return result;
}
int sasprintf(char **strp, const char *fmt, ...) {
va_list args;
int result;