[libvirt] [PATCH v3 00/35] use GNU C's cleanup attribute in src/util (batch I)

Sukrit Bhatnagar skrtbhtngr at gmail.com
Sat Jun 30 09:00:04 UTC 2018


This series of patches first introduces a new set of macros which help
in using GNU C's __attribute__((cleanup)) in the code.

Then a few syntax-check rules are added which help in ensuring correct
usage of the newly introduced cleanup macros.

Then the patches modify a few files in src/util to use VIR_AUTOFREE
and VIR_AUTOPTR for automatic freeing of memory and get rid of some
VIR_FREE macro invocations and *Free function calls.

Sukrit Bhatnagar (35):
  util: alloc: add macros for implementing automatic cleanup
    functionality
  cfg.mk: variable initialization when declared with cleanup macro
  cfg.mk: correct spacing between type and asterisk in VIR_AUTOFREE
  cfg.mk: single variable declaration per line when using cleanup macro
  cfg.mk: no trailing semicolon at line invoking VIR_DEFINE_* cleanup
    macro
  util: string: introduce typedef for string
  util: string: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
  util: command: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
  util: command: remove redundant include directive
  util: command: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: command: use VIR_AUTOPTR for aggregate types
  util: file: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
  util: file: remove redundant include directive
  util: file: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: file: use VIR_AUTOPTR for aggregate types
  util: authconfig: define cleanup function using
    VIR_DEFINE_AUTOPTR_FUNC
  util: authconfig: remove redundant include directive
  util: authconfig: use VIR_AUTOFREE instead of VIR_FREE for scalar
    types
  util: auth: remove redundant include directive
  util: auth: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: auth: use VIR_AUTOPTR for aggregate types
  util: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
  util: json: remove redundant include directive
  util: json: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: json: use VIR_AUTOPTR for aggregate types
  util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
  util: bitmap: remove redundant include directive
  util: bitmap: use VIR_AUTOPTR for aggregate types
  util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: audit: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: fcp: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: eventpoll: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: filecache: use VIR_AUTOFREE instead of VIR_FREE for scalar types
  util: identity: use VIR_AUTOFREE instead of VIR_FREE for scalar types

 cfg.mk                   |  37 ++++++
 src/util/iohelper.c      |   4 +-
 src/util/viralloc.h      |  44 +++++++
 src/util/virarptable.c   |  14 +-
 src/util/viraudit.c      |   3 +-
 src/util/virauth.c       |  61 +++------
 src/util/virauthconfig.c |  35 ++---
 src/util/virauthconfig.h |   3 +
 src/util/virbitmap.c     |   8 +-
 src/util/virbitmap.h     |   3 +
 src/util/vircommand.c    |  47 ++-----
 src/util/vircommand.h    |   2 +
 src/util/vireventpoll.c  |   7 +-
 src/util/virfcp.c        |  20 +--
 src/util/virfile.c       | 327 ++++++++++++++++-------------------------------
 src/util/virfile.h       |   3 +
 src/util/virfilecache.c  |  35 ++---
 src/util/viridentity.c   |  52 ++++----
 src/util/virjson.c       |  68 +++-------
 src/util/virjson.h       |   3 +
 src/util/virstring.h     |   5 +
 21 files changed, 319 insertions(+), 462 deletions(-)

-- 
1.8.3.1




More information about the libvir-list mailing list