[libvirt] [PATCHv3 14/36] util: string: Add helper to free non-NULL terminated string arrays
Eric Blake
eblake at redhat.com
Mon Jun 2 21:46:43 UTC 2014
On 05/30/2014 02:37 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.
Can't this just be done with:
array[count] = NULL;
virStringFreeList(array);
Furthermore, MOST of our allocation guarantees a NULL-terminated array
(VIR_ALLOC_N for example). Where did you actually run into a situation
where the tail wasn't already NULL?
> ---
> src/libvirt_private.syms | 1 +
> src/util/virstring.c | 20 ++++++++++++++++++++
> src/util/virstring.h | 1 +
> 3 files changed, 22 insertions(+)
I'm not quite sold on whether we need this. The code looks clean
enough, but without seeing it used in context, I'm reserving judgment
until later in the series.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140602/467e6705/attachment-0001.sig>
More information about the libvir-list
mailing list