On 06/20/14 00:41, Eric Blake wrote:
On 06/19/2014 07:59 AM, Peter Krempa wrote:
> Sometimes the length of the string list is known but the array isn't
> NULL terminated. Add helper to free the array in such cases.
> ---
> src/libvirt_private.syms | 1 +
> src/util/virstring.c | 20 ++++++++++++++++++++
> src/util/virstring.h | 1 +
> 3 files changed, 22 insertions(+)
I'm still not fully convinced we needed this (if you ALWAYS
over-allocate the array large enough for a NULL terminator, including in
Well I'm using it to free a string list that had the individual string
elements stolen from it, where the regular freeing function would finish
possibly on the first element as it might be already NULL and stolen.
This function should make sure that if some strings from the array are
not stolen for some reason that they are still freed.
VIR_APPEND_ELEMENT and friends), but it's easier to let it in
than to
force you to work around it. I would like to see coverage added in
tests/virstringtest.c, though.
Hmm testing a freeing function that frees the entire array? Not sure how
I'd approach it. Also is it really worth?
Peter