Re: [PATCH] hash: add common utility functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/05/14 01:49, Eric Blake wrote:
> I almost wrote a hash value free function that just called
> VIR_FREE, then realized I couldn't be the first person to
> do that.  Sure enough, it was worth factoring into a common
> helper routine.
> 
> Furthermore, in a few places we were passing raw free() as
> the cleanup function; whereas going through VIR_FREE() ensures
> that any (temporary) tracing or other memory stress testing
> that we add to viralloc.c will not be bypassed.
> 
> * src/util/virhash.h (virHashValueFree): New function.
> * src/util/virhash.c (virHashValueFree): Implement it.
> * src/util/virobject.h (virObjectFreeHashData): New function.
> * src/libvirt_private.syms (virhash.h, virobject.h): Export them.
> * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit): Use
> common function.
> * src/qemu/qemu_capabilities.c (virQEMUCapsCacheNew): Likewise.
> * src/qemu/qemu_command.c (qemuDomainCCWAddressSetCreate):
> Likewise.
> * src/qemu/qemu_monitor.c (qemuMonitorGetBlockInfo): Likewise.
> * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
> * src/util/virclosecallbacks.c (virCloseCallbacksNew): Likewise.
> * src/util/virkeyfile.c (virKeyFileParseGroup): Likewise.
> * tests/qemumonitorjsontest.c
> (testQemuMonitorJSONqemuMonitorJSONGetBlockInfo): Likewise.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
> 
> It turns out I may end up not using the common helper in my
> code after all, but the cleanup is still worth posting.
> 
>  src/libvirt_private.syms            |  2 ++
>  src/nwfilter/nwfilter_learnipaddr.c |  9 +--------
>  src/qemu/qemu_capabilities.c        |  9 +--------
>  src/qemu/qemu_command.c             |  8 +-------
>  src/qemu/qemu_monitor.c             |  2 +-
>  src/qemu/qemu_process.c             |  6 +-----
>  src/util/virclosecallbacks.c        | 11 ++---------
>  src/util/virhash.c                  |  9 ++++++++-
>  src/util/virhash.h                  |  5 ++++-
>  src/util/virkeyfile.c               |  9 ++-------
>  src/util/virobject.c                | 17 ++++++++++++++++-
>  src/util/virobject.h                |  3 ++-
>  tests/qemumonitorjsontest.c         |  6 +++---
>  13 files changed, 44 insertions(+), 52 deletions(-)

ACK,

Peter


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]