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

Laine Stump posted 15 patches 3 years, 9 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200707210815.1797463-1-laine@redhat.com
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(-)
[libvirt PATCH v2 00/15] convert network and nwfilter directories to glib memory allocation.
Posted by Laine Stump 3 years, 9 months ago
V1 was here:

https://www.redhat.com/archives/libvir-list/2020-June/msg01156.html

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:

  https://www.redhat.com/archives/libvir-list/2020-July/msg00185.html

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
    suggestion.


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
    label
  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(-)

-- 
2.25.4

Re: [libvirt PATCH v2 00/15] convert network and nwfilter directories to glib memory allocation.
Posted by Laine Stump 3 years, 9 months ago
ping

On 7/7/20 5:08 PM, Laine Stump wrote:
> V1 was here:
>
> https://www.redhat.com/archives/libvir-list/2020-June/msg01156.html
>
> 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:
>
>    https://www.redhat.com/archives/libvir-list/2020-July/msg00185.html


^^ This has been pushed, so there are no longer any extra prerequisites.


>
> 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
>      suggestion.
>
>
> 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
>      label
>    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(-)
>