]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: rename two *Free() functions while changing VIR_FREE to g_free
authorLaine Stump <laine@redhat.com>
Thu, 4 Feb 2021 02:38:59 +0000 (21:38 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 5 Feb 2021 05:20:45 +0000 (00:20 -0500)
commit8626fb378cc009757bbad7c9ef46b90dd5221dfe
tree697ea41ef473249608a64faf7a0b38bab9aa4e96
parentbb6fa828f9f8c2bb46d2ae2af31c0a30fd7a0349
util: rename two *Free() functions while changing VIR_FREE to g_free

dhcpHostFree() and addnHostFree() don't follow the normal pattern of
*Free functions in the rest of libvirt code - they are actually more
similar to the *Dispose() functions, in that they free all subordinate
objects, but not the object pointed to by the argument
itself. However, the arguments aren't virObjects, so it wouldn't be
proper to name them *Dispose() either.

They *currently* behave similar to a *Clear() function, in that they
free all the subordinate objects and nullify the pointers of those
objects. HOWEVER, we don't actually need or want that behavior - the
two functions in question are only called as part of a higher level
*Free() function, and the pointers are not referenced in any way
between the time they are freed and when the parent object is freed.

So, since the current name isn't correct, nor is *Dispose(), and we
want to change the behavior in such a way that *Clear() also wouldn't
be correct, lets name the functions *FreeContent(), which is an
accurate description of what the functions do, and what we *want* them
to do.

And since it's such a small patch, we can go ahead and change that
behavior - replacing the VIR_FREEs with g_free.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/util/virdnsmasq.c