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

Sukrit Bhatnagar posted 31 patches 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1531504509-7930-1-git-send-email-skrtbhtngr@gmail.com
Test syntax-check passed
cfg.mk                   |  11 ++
src/util/iohelper.c      |   4 +-
src/util/viralloc.h      |  42 ++++++
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    |  51 +++-----
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, 292 insertions(+), 465 deletions(-)
[libvirt] [PATCH v4 00/31] use GNU C's cleanup attribute in src/util (batch I)
Posted by Sukrit Bhatnagar 5 years, 9 months ago
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 (31):
  util: alloc: add macros for implementing automatic cleanup
    functionality
  cfg.mk: variable initialization when declared with cleanup macro
  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                   |  11 ++
 src/util/iohelper.c      |   4 +-
 src/util/viralloc.h      |  42 ++++++
 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    |  51 +++-----
 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, 292 insertions(+), 465 deletions(-)

-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4 00/31] use GNU C's cleanup attribute in src/util (batch I)
Posted by Erik Skultety 5 years, 9 months ago
On Fri, Jul 13, 2018 at 11:24:38PM +0530, Sukrit Bhatnagar wrote:
> 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.
>

Small note for future patch revisions, we tend to add a link to the archives
for previous references as well as a brief description of the changes made
against the previous version, you can find plenty of examples on the list on
how contributors do that (you can find the archives here [1]).
Anyhow, as there were no problems with v4, I went ahead and pushed the series,
looking forward to next patch series.

Erik

[1] https://www.redhat.com/archives/libvir-list/

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