[PATCH 0/3] get rid of virDomainNetDefClear()

Laine Stump posted 3 patches 3 years, 6 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200930230811.408300-1-laine@redhat.com
src/conf/domain_conf.c   | 51 +++++++++++++++++-----------------------
src/conf/domain_conf.h   |  1 -
src/libvirt_private.syms |  1 -
src/qemu/qemu_driver.c   | 26 +++++++++-----------
4 files changed, 33 insertions(+), 46 deletions(-)
[PATCH 0/3] get rid of virDomainNetDefClear()
Posted by Laine Stump 3 years, 6 months ago
While looking for something else, I noticed that there were only 2
callers to virDomainNetDefClear(), and one of those was virDomain
NetDefFree(). virDomainNetDefClear() necessarily has a lot of
VIR_FREE() in it that couldn't be changed to g_free() (because it's
possible the object will be used after it is cleared). This series
eliminates the actual practical usage of virDomainNetDefClear() by
just creating a new object instead of clearing and re-using the old
object, then moves the contents of virDomainNetDefClear() into
virDomainNetDefFree(), and finally changes all the uses of VIR_FREE()
to g_free() (now that it's safe to do so).

Laine Stump (3):
  qemu: eliminate use of virDomainNetDefClear() in
    qemuConnectDomainXMLToNative()
  conf: eliminate virDomainNetDefClear()
  conf: use g_free() instead of VIR_FREE in virDomainNetDefFree()

 src/conf/domain_conf.c   | 51 +++++++++++++++++-----------------------
 src/conf/domain_conf.h   |  1 -
 src/libvirt_private.syms |  1 -
 src/qemu/qemu_driver.c   | 26 +++++++++-----------
 4 files changed, 33 insertions(+), 46 deletions(-)

-- 
2.26.2

Re: [PATCH 0/3] get rid of virDomainNetDefClear()
Posted by Michal Prívozník 3 years, 6 months ago
On 10/1/20 1:08 AM, Laine Stump wrote:
> While looking for something else, I noticed that there were only 2
> callers to virDomainNetDefClear(), and one of those was virDomain
> NetDefFree(). virDomainNetDefClear() necessarily has a lot of
> VIR_FREE() in it that couldn't be changed to g_free() (because it's
> possible the object will be used after it is cleared). This series
> eliminates the actual practical usage of virDomainNetDefClear() by
> just creating a new object instead of clearing and re-using the old
> object, then moves the contents of virDomainNetDefClear() into
> virDomainNetDefFree(), and finally changes all the uses of VIR_FREE()
> to g_free() (now that it's safe to do so).
> 
> Laine Stump (3):
>    qemu: eliminate use of virDomainNetDefClear() in
>      qemuConnectDomainXMLToNative()
>    conf: eliminate virDomainNetDefClear()
>    conf: use g_free() instead of VIR_FREE in virDomainNetDefFree()
> 
>   src/conf/domain_conf.c   | 51 +++++++++++++++++-----------------------
>   src/conf/domain_conf.h   |  1 -
>   src/libvirt_private.syms |  1 -
>   src/qemu/qemu_driver.c   | 26 +++++++++-----------
>   4 files changed, 33 insertions(+), 46 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal