Add wrapper function for free and strdup

Reduces code in callers and helps avoiding memory leaks.
This commit is contained in:
Christian Göttsche
2021-01-05 14:47:49 +01:00
committed by BenBE
parent 958112c5a3
commit 70f48f1f44
6 changed files with 19 additions and 21 deletions

View File

@ -69,6 +69,7 @@ ATTR_FORMAT(printf, 3, 4)
int xSnprintf(char* buf, size_t len, const char* fmt, ...);
char* xStrdup(const char* str) ATTR_NONNULL;
void free_and_xStrdup(char** ptr, const char* str);
char* xStrndup(const char* str, size_t len) ATTR_NONNULL;