Add xReallocArrayZero() helper

Add helper function to reallocate an dynamic allocated array including
zeroing the newly allocated memory.
This commit is contained in:
Christian Göttsche
2021-09-10 15:09:42 +02:00
committed by BenBE
parent 8f259bc5e1
commit bf395e10c5
2 changed files with 18 additions and 0 deletions

View File

@ -30,6 +30,8 @@ void* xRealloc(void* ptr, size_t size) ATTR_ALLOC_SIZE1(2);
void* xReallocArray(void* ptr, size_t nmemb, size_t size) ATTR_ALLOC_SIZE2(2, 3);
void* xReallocArrayZero(void* ptr, size_t prevmemb, size_t newmemb, size_t size) ATTR_ALLOC_SIZE2(3, 4);
/*
* String_startsWith gives better performance if strlen(match) can be computed
* at compile time (e.g. when they are immutable string literals). :)