]> git.ipfire.org Git - thirdparty/libvirt.git/commit
python: use libvirt_util to avoid raw free
authorEric Blake <eblake@redhat.com>
Thu, 2 Feb 2012 22:45:54 +0000 (15:45 -0700)
committerEric Blake <eblake@redhat.com>
Fri, 3 Feb 2012 17:41:47 +0000 (10:41 -0700)
commitc700613b8d463212d142c97108b7a2352e23e559
tree4e8e5e8aba9e126897b8c6b6b1f924c96d6dcf3d
parent8fe454ce90899945b1d16674668a0208657b6e61
python: use libvirt_util to avoid raw free

This patch starts the process of elevating the python binding code
to be on the same level as the rest of libvirt when it comes to
requiring good coding styles.  Statically linking against the
libvirt_util library makes it much easier to write good code,
rather than having to open-code and reinvent things locally.

Done by global search and replace of s/free(/VIR_FREE(/, followed
by hand-inspection of remaining malloc and redundant memset.

* cfg.mk (exclude_file_name_regexp--sc_prohibit_raw_allocation):
Remove python from exemption.
* python/Makefile.am (INCLUDES): Add gnulib and src/util.  Drop
$(top_builddir)/$(subdir), as automake already guarantees that.
(mylibs, myqemulibs): Pull in libvirt_util and gnulib.
(libvirtmod_la_CFLAGS): Catch compiler warnings if configured to
use -Werror.
* python/typewrappers.c (libvirt_charPtrSizeWrap)
(libvirt_charPtrWrap): Convert free to VIR_FREE.
* python/generator.py (print_function_wrapper): Likewise.
* python/libvirt-override.c: Likewise.
cfg.mk
python/Makefile.am
python/generator.py
python/libvirt-override.c
python/typewrappers.c