Avoid redundant strlen and duplicate traversals when loading content strings

This commit is contained in:
Andrea Mazzoleni 2026-10-03 17:00:24 +02:00
parent 969cb5ca31
commit 3d7a722ab2
5 changed files with 99 additions and 25 deletions

View file

@ -36,6 +36,12 @@ void* calloc_nofail(size_t count, size_t size);
*/
char* strdup_nofail(const char* str);
/**
* Safe strndup with known length.
* If no memory is available, it aborts.
*/
char* strndup_nofail(const char* str, size_t size);
/**
* Helper for printing an error about a failed allocation.
*/