[libvirt] [PATCH 00/13] Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

Michal Privoznik mprivozn at redhat.com
Fri Mar 7 09:45:56 UTC 2014


The aim of this patch is to substitute the following pattern:

    VIR_REALLOC(array, cnt + 1);
    array[cnt++] = new_elem;

with shorter:

    VIR_APPEND_ELEMENT(array, cnt, new_elem);

In addition, remove writable-only memmove() when removing elements, with
VIR_DELETE_ELEMENT().

Completeness is not the goal. Yes, there can be a few untouched places left
behind that could be transformed too. This is just a first shot to substitute
obvious patterns.

Michal Privoznik (13):
  conf: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/lxc/: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/nwfilter: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/openvz: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/parallels: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/phyp: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/qemu: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/rpc: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/storage: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/test: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/util: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/xen: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT
  src/xenxs: Utilize more of VIR_(APPEND|INSERT|DELETE)_ELEMENT

 src/conf/domain_conf.c                 | 120 +++++++--------------------------
 src/conf/domain_conf.h                 |   4 +-
 src/conf/interface_conf.c              |  26 +++----
 src/conf/interface_conf.h              |   2 +-
 src/conf/network_conf.c                |  30 +++------
 src/conf/network_conf.h                |   4 +-
 src/conf/node_device_conf.c            |  16 +----
 src/conf/node_device_conf.h            |   2 +-
 src/conf/nwfilter_conf.c               |  33 +++------
 src/conf/nwfilter_conf.h               |   8 +--
 src/conf/nwfilter_params.c             |  12 +---
 src/conf/nwfilter_params.h             |   2 +-
 src/conf/object_event.c                |  14 +---
 src/conf/storage_conf.c                |  16 +----
 src/lxc/lxc_container.c                |   9 +--
 src/nwfilter/nwfilter_gentech_driver.c |  13 ++--
 src/openvz/openvz_conf.c               |  12 +---
 src/parallels/parallels_driver.c       |  15 ++---
 src/parallels/parallels_storage.c      |  32 +++------
 src/phyp/phyp_driver.c                 |  16 ++---
 src/phyp/phyp_driver.h                 |   2 +-
 src/qemu/qemu_command.c                |  90 ++++++++++---------------
 src/qemu/qemu_conf.c                   |   8 +--
 src/qemu/qemu_conf.h                   |   2 +-
 src/qemu/qemu_driver.c                 |  14 ++--
 src/qemu/qemu_monitor_json.c           |   2 +-
 src/qemu/qemu_monitor_text.c           |   3 +-
 src/rpc/virnetclient.c                 |  11 +--
 src/rpc/virnetserver.c                 |  11 +--
 src/storage/storage_backend_disk.c     |  13 ++--
 src/storage/storage_backend_fs.c       |   5 +-
 src/storage/storage_backend_iscsi.c    |   5 +-
 src/storage/storage_backend_logical.c  |   8 +--
 src/storage/storage_backend_mpath.c    |   4 +-
 src/storage/storage_backend_rbd.c      |  10 ++-
 src/storage/storage_backend_scsi.c     |   4 +-
 src/test/test_driver.c                 |  41 +++--------
 src/util/virjson.c                     |  12 +---
 src/util/virlockspace.c                |  12 +---
 src/xen/xen_driver.c                   |  19 +-----
 src/xen/xen_driver.h                   |   2 +-
 src/xen/xen_inotify.c                  |  13 +---
 src/xen/xm_internal.c                  |  18 +----
 src/xen/xs_internal.c                  |  19 +-----
 src/xen/xs_internal.h                  |   2 +-
 src/xenxs/xen_sxpr.c                   |  43 +++++-------
 src/xenxs/xen_xm.c                     |  27 +++-----
 47 files changed, 222 insertions(+), 564 deletions(-)

-- 
1.9.0




More information about the libvir-list mailing list