[libvirt PATCH v2 00/15] convert network and nwfilter directories to glib memory allocation.

Laine Stump laine at redhat.com
Tue Jul 7 21:08:00 UTC 2020

V1 was here:


Some patches were ACKed and pushed. I re-ordered/re-organized most of
the rest, and removed some others to deal with separately (the
xmlNodeContent stuff)

What's left here is a few preliminary patches, then the standard set,
once for network and again for nwfilter:

1) convert from VIR_(RE)ALLOC(_N) to g_new0()/g_renew()
2) use g_auto*() where appropriate, removing unneeded free's
3) get rid of now-extraneous labels
4) (controversial) replace any remaining VIR_FREE() with g_free() (and
   possibly g_clear_pointer() when needed

NB: these patches require my virBuffer "convert to g_auto" series
as a prerequisite:


Changes from V1:

  * move conversion of virFirewall and virBuffer automatics to another
    series (see above)
  * re-order to replace VIR_ALLOC first (without adding any g_auto*)
    instead of doing it after g_auto conversion of automatics, then do
    all g_auto additions at o

  * separate label elimination into separate patches per jtomko's

Laine Stump (15):
  replace g_new() with g_new0() for consistency
  util: define g_autoptr cleanups for a couple dnsmasq objects
  define g_autoptr cleanup function for virNetworkDHCPLease
  network: replace VIR_ALLOC/REALLOC with g_new0/g_renew
  network: use g_auto wherever appropriate
  network: eliminate unnecessary labels
  network: use g_free() in place of remaining VIR_FREE()
  nwfilter: remove unnecessary code from ebtablesGetSubChainInsts()
  nwfilter: clear nrules when resetting virNWFilterInst
  nwfilter: define a typedef for struct ebtablesSubChainInst
  nwfilter: transform logic in virNWFilterRuleInstSort to eliminate
  nwfilter: use standard label names when reasonable
  nwfilter: replace VIR_ALLOC with g_new0
  nwfilter: convert local pointers to use g_auto*
  nwfilter: convert remaining VIR_FREE() to g_free()

 src/datatypes.h                           |   2 +
 src/network/bridge_driver.c               | 536 ++++++++--------------
 src/network/bridge_driver_linux.c         |  22 +-
 src/network/leaseshelper.c                |  16 +-
 src/nwfilter/nwfilter_dhcpsnoop.c         | 150 +++---
 src/nwfilter/nwfilter_driver.c            |  13 +-
 src/nwfilter/nwfilter_ebiptables_driver.c | 119 ++---
 src/nwfilter/nwfilter_gentech_driver.c    |  57 ++-
 src/nwfilter/nwfilter_learnipaddr.c       |  43 +-
 src/qemu/qemu_backup.c                    |   2 +-
 src/util/virdnsmasq.h                     |   4 +
 src/util/virutil.c                        |   2 +-
 tests/qemuhotplugmock.c                   |   2 +-
 13 files changed, 379 insertions(+), 589 deletions(-)


More information about the libvir-list mailing list