[libvirt] [PATCHv3 00/17] new VIR_(APPEND|INSERT|DELETE)_ELEMENT macros
Eric Blake
eblake at redhat.com
Fri Dec 7 18:53:49 UTC 2012
On 12/07/2012 11:16 AM, Laine Stump wrote:
> DO NOT BE SCARED OFF BY THE PATCH COUNT!! Most of these are very
> short, and they all follow the same pattern; beyond that, 01/17 and
> 02/17 are the only ones that are really time-sensitive.
>
> The first patch in this series adds new macros to insert/append/delete
> elements from the arrays of variously-sized structs that are commonly
> used in libvirt. The intent is to eliminate the arithmetic mistakes
> associated with calling memmove() directly, and shorten application
> code. A full description of the added macros and their functions is
> included in 01/17.
>
> Patches 02..17 convert various bits of hand-coded array manipulation
> in libvirt to use the new macros. They can be taken now, later, or
> never (although I'd like to have at least 02/17 taken now, since other
> similar functions will be added in an upcoming patch series, and I
> want them to all use the same logic). Mostly I went through all of
> those conversions to see just how useful/usable the new macros were
> (and they led to a couple of rewrites).
>
> I will be posting another series momentarily that has a dependency on
> 01/17.
Dunno why you don't have a diffstat, to make it a bit more impressive
(the --cover-letter option to get send-email or git format will create a
diffstat into your 0/17 mail):
cfg.mk | 2 +-
src/conf/domain_conf.c | 152
++++++---------------------------
src/conf/domain_conf.h | 12 +--
src/conf/domain_event.c | 51 ++---------
src/conf/interface_conf.c | 13 +--
src/conf/interface_conf.h | 4 +-
src/conf/network_conf.c | 102 ++++++----------------
src/conf/network_conf.h | 6 +-
src/conf/node_device_conf.c | 11 +--
src/conf/node_device_conf.h | 4 +-
src/conf/nwfilter_conf.c | 46 ++++------
src/conf/nwfilter_conf.h | 8 +-
src/conf/nwfilter_params.c | 8 +-
src/conf/storage_conf.c | 11 +--
src/conf/storage_conf.h | 4 +-
src/libvirt_private.syms | 2 +
src/nwfilter/nwfilter_gentech_driver.c | 15 ++--
src/parallels/parallels_storage.c | 14 +--
src/qemu/qemu_cgroup.c | 2 +-
src/qemu/qemu_cgroup.h | 2 +-
src/qemu/qemu_domain.c | 6 +-
src/qemu/qemu_driver.c | 4 +-
src/rpc/virnetclient.c | 21 +----
src/rpc/virnetserver.c | 14 +--
src/storage/storage_backend_rbd.c | 2 +-
src/storage/storage_driver.c | 12 +--
src/test/test_driver.c | 14 +--
src/util/ebtables.c | 29 ++-----
src/util/ebtables.h | 4 +-
src/util/hostusb.c | 26 ++----
src/util/memory.c | 102 +++++++++++++++++++++-
src/util/memory.h | 118 ++++++++++++++++++++++++-
src/util/pci.c | 18 +---
src/util/threads-win32.c | 15 +---
src/util/virlockspace.c | 20 +----
src/xen/xen_driver.c | 14 +--
src/xen/xen_driver.h | 4 +-
src/xen/xen_inotify.c | 16 +---
src/xen/xm_internal.c | 14 +--
src/xen/xs_internal.c | 13 +--
src/xen/xs_internal.h | 2 +-
tests/qemumonitortestutils.c | 23 +----
42 files changed, 384 insertions(+), 576 deletions(-)
That is, in spite of 200+ lines added to memory.[ch], you still managed
to let the series have a net reduction of nearly 200 lines to the
overall code base by shaving redundant code elsewhere, all while making
the usage pattern safer :)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121207/ec018f50/attachment-0001.sig>
More information about the libvir-list
mailing list