]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: cgroup: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC
authorSukrit Bhatnagar <skrtbhtngr@gmail.com>
Tue, 24 Jul 2018 15:52:09 +0000 (21:22 +0530)
committerErik Skultety <eskultet@redhat.com>
Fri, 27 Jul 2018 15:19:18 +0000 (17:19 +0200)
commit4da4a9fe0c0956feefe3d592b4ba2b92b2a9a2f9
treed212b500de37afe66c6aa74bdcf8a0897c48faac
parent0f80c71822d82465d558d697d3be9af2d21e3675
util: cgroup: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in
src/util/viralloc.h, define a new wrapper around an existing
cleanup function which will be called when a variable declared
with VIR_AUTOPTR macro goes out of scope. Also, drop the redundant
viralloc.h include, since that has moved from the source module into
the header.

When a variable of type virCgroupPtr is declared using
VIR_AUTOPTR, the function virCgroupFree will be run
automatically on it when it goes out of scope.

This commit also adds an intermediate typedef for virCgroup
type for use with the cleanup macros.

Signed-off-by: Sukrit Bhatnagar <skrtbhtngr@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/util/vircgroup.c
src/util/vircgroup.h
src/util/vircgrouppriv.h