]> xenbits.xensource.com Git - libvirt.git/commit
conf: simplify virDomainCapsDispose()
authorLaine Stump <laine@redhat.com>
Tue, 2 Feb 2021 06:11:30 +0000 (01:11 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 5 Feb 2021 05:22:09 +0000 (00:22 -0500)
commitf772c4869783b3af1a94defe7d85180c2ef8da65
treecfc7af4331f9f7705be5b0f7f8b9d82ffb822a53
parent1745297d51929107e31d0adb3ae5240751c29b03
conf: simplify virDomainCapsDispose()

virDomainCapsDispose() was the only caller of
virDomainCapsStringValuesFree(), which 1) didn't actually free the
object it was called with, but only cleared it, making it less
mechanical to convert from VIR_FREE to g_free (since it's not
immediately obvious from looking at virDomainCapsStringValuesFree()
that the pointers being cleared will never again be used).

We could have renamed the function to virDomainCapsStringValuesClear()
to side-step the confusion of what the function actually does, but
that would just make the upcoming switch from VIR_FREE to g_free
require more thought. But since there is only a single caller to the
function, and it is a vir*Dispose() function (indicating that the
object containing the virDomainCapsStringValues is going to be freed
immediately after the function finishes), and thus VIR_FREE() *could*
be safely replaced by g_free()), we instead just move the contents of
virDomainCapsStringValuesFree() into virDomainCapsDispose() (and
*that* function will be trivially converted in an upcoming
"mechanical" patch).

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