Hi,
I am Sukrit Bhatnagar, selected in GSoC '18 for the project
"Automatic freeing of resources". I will be modifying the libvirt
core C library to add functionality for GCC cleanup attribute.
Over the next couple of months, I will be discussing the general
code design in this l
On 23 May 2018 at 21:35, Pavel Hrdina <phrd...@redhat.com> wrote:
> On Sun, Mar 25, 2018 at 01:55:07AM +0530, Sukrit Bhatnagar wrote:
>> Hi,
>>
>> I am interested in implementing the GCC cleanup attribute for automatic
>> resource freeing as part of GSoC'18. I ha
On Tue, 5 Jun 2018 at 21:00, Erik Skultety wrote:
>
> On Sun, Jun 03, 2018 at 01:41:59PM +0530, Sukrit Bhatnagar wrote:
> > New macros are added to src/util/viralloc.h which help in
> > adding cleanup attribute to variable declarations.
> >
> > Signed-off-by: Sukri
Hi,
I am starting this discussion thread as a continuation of my GSoC
weekly meeting with Erik and Pavel on 8th June.
I was going through src/util/virstring.c for adding cleanup macros and
saw that virStringListFree takes on char ** as an argument, and
equivalently, we declare a list of strings
The include directive for viralloc.h is added in virauthconfig.h
in the previous patch.
---
src/util/virauthconfig.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 91c9c0c..3487cc2 100644
--- a/src/util/virauthconfig.c
+++
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/virauth.c | 45 +
1 file changed, 13
Using the 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.
---
src/util/virjson.h | 3 +++
1 file changed, 3 insertions(+)
diff --git
Using the 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.
---
src/util/virauthconfig.h | 3 +++
1 file changed, 3 insertions(+)
diff
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/virfcp.c | 20 ++--
1 file changed, 6 insertions(+), 14 deletions(-)
The include directive for viralloc.h is added in virauthconfig.h
in a previous patch.
---
src/util/virauth.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virauth.c b/src/util/virauth.c
index adb093e..c6a2ce7 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -26,7 +26,6 @@
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOPTR
macro, majority of the calls to *Free functions can be dropped, which in
turn leads to getting rid of most of our cleanup sections.
---
src/util/virjson.c | 15 ---
1 file changed, 4 insertions(+), 11
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOPTR
macro, majority of the calls to *Free functions can be dropped, which in
turn leads to getting rid of most of our cleanup sections.
---
src/util/virauth.c | 15 +--
1 file changed, 5 insertions(+), 10
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/virjson.c | 29 +
1 file changed, 9 insertions(+), 20
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/viraudit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/virfilecache.c | 35 +++
1 file changed, 11
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/vireventpoll.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)
diff
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/virauthconfig.c | 34 --
1 file changed, 12
The include directive for viralloc.h is added in virbitmap.h
in the previous patch.
---
src/util/virbitmap.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0cc5292..ef18dad 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -31,7
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOPTR
macro, majority of the calls to *Free functions can be dropped, which in
turn leads to getting rid of most of our cleanup sections.
---
src/util/virbitmap.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)
The include directive for viralloc.h is added in virjson.h
in the previous patch.
---
src/util/virjson.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 0559d40..92f3994 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -24,7 +24,6 @@
Using the 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.
---
src/util/virbitmap.h | 3 +++
1 file changed, 3 insertions(+)
diff --git
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/viridentity.c | 54 --
1 file changed,
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/iohelper.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git
New macros are added to src/util/viralloc.h which help in
adding GCC's cleanup attribute to variable declarations.
---
src/util/viralloc.h | 68 +
1 file changed, 68 insertions(+)
diff --git a/src/util/viralloc.h b/src/util/viralloc.h
index
function calls.
Sukrit Bhatnagar (21):
add macros for implementing automatic cleanup functionality
util: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types
util: audit: use VIR_AUTOFREE instead of VIR_FREE
By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOFREE
macro, majority of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
---
src/util/virarptable.c | 14 +++---
1 file changed, 3 insertions(+), 11 deletions(-)
; > On Mon, Jun 11, 2018 at 12:12:16PM +0200, Pavel Hrdina wrote:
> > > > > On Sat, Jun 09, 2018 at 11:12:29PM +0200, Martin Kletzander wrote:
> > > > > > On Sat, Jun 09, 2018 at 10:06:55PM +0530, Sukrit Bhatnagar wrote:
> > > > > > > Hi,
> &
New macros are added to src/util/viralloc.h which help in
adding cleanup attribute to variable declarations.
Signed-off-by: Sukrit Bhatnagar
---
src/util/viralloc.h | 69 +
1 file changed, 69 insertions(+)
diff --git a/src/util/viralloc.h b
This series of patches aim at augmenting our discussion about the
design for implementing the cleanup attribute.
A set of macros have been added at the end of viralloc.h
A few files have been modified to use the newly created macros.
Sukrit Bhatnagar (4):
add macros for implementing automatic
Modifiy code to use cleanup macros where required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauthconfig.c | 34 --
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 91c9c0c..66f7f7e
Define a new cleanup function for virAuthConfigPtr in
src/util/virauthconfig.h.
Modifiy code to use cleanup macros where required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauth.c | 66 ++--
src/util/virauthconfig.h | 3 +++
2 files
Modifiy code to use cleanup macros where required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virarptable.c | 9 ++---
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
index c0e90dc..f53a479 100644
--- a/src/util/virarptable.c
On 29 May 2018 at 10:36, Michal Privoznik wrote:
> On 05/28/2018 09:34 AM, Sukrit Bhatnagar wrote:
>>
>> This is what new macros will look like:
>>
>> # define _VIR_TYPE_PTR(type) type##Ptr
>>
>> # define _VIR_ATTR_AUTOFREE_PTR(type) __attribu
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virarptable.c | 9 ++---
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/util/virarptable.c b/src/util/virarptable.c
index c0e90dc..f53a479 100644
--- a/src/util
New macros are added to src/util/viralloc.h which help in
adding cleanup attribute to variable declarations.
Signed-off-by: Sukrit Bhatnagar
---
src/util/viralloc.h | 69 +
1 file changed, 69 insertions(+)
diff --git a/src/util/viralloc.h b
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/viraudit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 0085dc3..a49d458 100644
--- a/src/util/viraudit.c
+++ b/src/util
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauth.c | 60 +++---
1 file changed, 21 insertions(+), 39 deletions(-)
diff --git a/src/util/virauth.c b/src/util/virauth.c
index adb093e
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/vircgroup.c | 526 ++-
1 file changed, 179 insertions(+), 347 deletions(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/iohelper.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index bb8a8dd..f7794dc 100644
--- a/src/util/iohelper.c
+++ b/src
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfilecache.c | 35 +++
1 file changed, 11 insertions(+), 24 deletions(-)
diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c
index dab7216..49049b7
This series of patches modifies some files in src/util
to use VIR_AUTOFREE for automatic freeing of memory and
get rid of some VIR_FREE macro invocations.
Sukrit Bhatnagar (18):
add macros for implementing automatic cleanup functionality
use VIR_AUTOFREE in src/util/virarptable.c
use
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauthconfig.c | 34 --
1 file changed, 12 insertions(+), 22 deletions(-)
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 91c9c0c
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfirewall.c | 13 -
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 10c370a..568612c 100644
--- a/src/util
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfcp.c | 20 ++--
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/util/virfcp.c b/src/util/virfcp.c
index 7660ba7..b703744 100644
--- a/src/util/virfcp.c
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virbuffer.c | 33 -
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/util/virbuffer.c b/src/util/virbuffer.c
index 3d6defb..5152f73 100644
On Wed, 6 Jun 2018 at 21:25, Erik Skultety wrote:
>
> On Wed, Jun 06, 2018 at 06:42:29PM +0530, Sukrit Bhatnagar wrote:
> > On Tue, 5 Jun 2018 at 21:00, Erik Skultety wrote:
> > >
> > > On Sun, Jun 03, 2018 at 01:41:59PM +0530, Sukrit Bhatnagar wrote:
> >
On 28 May 2018 at 13:54, Pavel Hrdina <phrd...@redhat.com> wrote:
> On Mon, May 28, 2018 at 01:04:28PM +0530, Sukrit Bhatnagar wrote:
>> On 25 May 2018 at 16:20, Pavel Hrdina <phrd...@redhat.com> wrote:
>> > On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani w
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virdnsmasq.c | 116 +-
1 file changed, 39 insertions(+), 77 deletions(-)
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virconf.c | 42 --
1 file changed, 12 insertions(+), 30 deletions(-)
diff --git a/src/util/virconf.c b/src/util/virconf.c
index e0a3fd1..7dd8820 100644
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfdstream.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c
index e4973a2..e7befbc 100644
--- a/src/util/virfdstream.c
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virhook.c | 16 +---
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/util/virhook.c b/src/util/virhook.c
index facd74a..51f0eb5 100644
--- a/src/util/virhook.c
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virdbus.c | 28 +++-
1 file changed, 7 insertions(+), 21 deletions(-)
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index ba8b684..66dbe41 100644
--- a/src/util
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/vireventpoll.c | 7 ++-
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index 81ecab4..13d278d 100644
--- a/src/util
Modify code to use VIR_AUTOFREE macro wherever required.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfile.c | 303 +
1 file changed, 99 insertions(+), 204 deletions(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 523241f
On 25 May 2018 at 16:20, Pavel Hrdina wrote:
> On Fri, May 25, 2018 at 12:06:50PM +0200, Andrea Bolognani wrote:
>> On Fri, 2018-05-25 at 10:04 +0200, Pavel Hrdina wrote:
>> > On Fri, May 25, 2018 at 09:13:51AM +0200, Andrea Bolognani wrote:
>> > > However, I realize it might
Alias virString to (char *) so that the new cleanup macros
can be used for a list of strings (char **).
Signed-off-by: Sukrit Bhatnagar
---
src/util/virstring.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/util/virstring.h b/src/util/virstring.h
index 607ae66..ac930fd 100644
Add rule to ensure that there is exactly one blank space between
the type name and the asterisk when passed as the argument to the
VIR_AUTOFREE macro.
Signed-off-by: Sukrit Bhatnagar
---
cfg.mk | 9 +
1 file changed, 9 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index 196d1b2..d9e90d5
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/vircommand.c | 40
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauthconfig.c | 34
, the function virFileWrapperFdFree will be run
automatically on it when it goes out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfile.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virfile.h b/src/util/virfile.h
index 6f1e802..b30a1d3 100644
--- a/src/util/virfile.h
The include directive for viralloc.h is added in virauthconfig.h
in a previous patch.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauth.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virauth.c b/src/util/virauth.c
index adb093e..c6a2ce7 100644
--- a/src/util/virauth.c
+++ b
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/iohelper.c | 4 +---
1
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virjson.c | 49
The include directive for viralloc.h is added in virauthconfig.h
in a previous patch.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauthconfig.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 91c9c0c..3487cc2 100644
--- a/src/util
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauth.c | 45
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/viridentity.c | 52
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfile.c | 310
,
the function virStringListFree will be run automatically on it when
it goes out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virstring.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virstring.h b/src/util/virstring.h
index ac930fd..726e02b 100644
--- a/src/util/virstring.h
for multiple declarations in a line. This rule takes care of
that too.
Signed-off-by: Sukrit Bhatnagar
---
cfg.mk | 8
1 file changed, 8 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index d9e90d5..7949fc8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1077,6 +1077,14
The include directive for viralloc.h is added in vircommand.h
in a previous patch.
Signed-off-by: Sukrit Bhatnagar
---
src/util/vircommand.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 6dab105..8681e7b 100644
--- a/src/util/vircommand.c
Add rule to ensure that there is no semicolon at the end of
the line where a VIR_DEFINE_* cleanup macro is invoked.
Signed-off-by: Sukrit Bhatnagar
---
cfg.mk | 9 +
1 file changed, 9 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index 7949fc8..d292005 100644
--- a/cfg.mk
+++ b/cfg.mk
,
the function virCommandFree will be run automatically on it when it
goes out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/vircommand.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index 883e212..90bcc6c 100644
--- a/src/util/vircommand.h
, the function virAuthConfigFree will be run
automatically on it when it goes out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virauthconfig.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virauthconfig.h b/src/util/virauthconfig.h
index ac0ceeb..d8a3849 100644
--- a/src
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
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
-by: Sukrit Bhatnagar
---
cfg.mk | 11 +++
1 file changed, 11 insertions(+)
diff --git a/cfg.mk b/cfg.mk
index 6bebd0a..196d1b2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1057,6 +1057,17 @@ sc_prohibit_backslash_alignment:
halt='Do not attempt to right-align backslashes
New macros are introduced which help in adding GNU C's cleanup
attribute to variable declarations. Variables declared with these
macros will have their allocated memory freed automatically when
they go out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/viralloc.h | 44
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
The include directive for viralloc.h is added in virbitmap.h
in a previous patch.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virbitmap.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0cc5292..ef18dad 100644
--- a/src/util/virbitmap.c
The include directive for viralloc.h is added in virjson.h
in a previous patch.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virjson.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virjson.c b/src/util/virjson.c
index 0559d40..92f3994 100644
--- a/src/util/virjson.c
+++ b/src/util
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/viraudit.c | 3 +--
1 file
The include directive for viralloc.h is added in virfile.h
in a previous patch.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfile.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 378d03e..2690e2d 100644
--- a/src/util/virfile.c
+++ b/src/util
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfilecache.c | 35
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
, the function virBitmapFree will be run
automatically on it when it goes out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virbitmap.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virbitmap.h b/src/util/virbitmap.h
index 2464814..312e7e2 100644
--- a/src/util/virbitmap.h
+++ b
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/vireventpoll.c | 7
, the function virJSONValueFree will be run
automatically on it when it goes out of scope.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virjson.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/util/virjson.h b/src/util/virjson.h
index e4a82bd..75f7f17 100644
--- a/src/util/virjson.h
+++ b
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virfcp.c | 20
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virarptable.c | 14
On Mon, 18 Jun 2018 at 17:20, Andrea Bolognani wrote:
>
> On Mon, 2018-06-18 at 11:52 +0100, Daniel P. Berrangé wrote:
> > On Mon, Jun 18, 2018 at 12:24:39PM +0200, Pavel Hrdina wrote:
> > > # define VIR_DEFINE_AUTOCLEAR_FUNC(type, func) \
> > > static inline void
On Fri, 3 Aug 2018 at 18:49, Erik Skultety wrote:
>
> On Sat, Jul 28, 2018 at 11:31:31PM +0530, Sukrit Bhatnagar wrote:
> > By making use of GNU C's cleanup attribute handled by the
> > VIR_AUTOPTR macro for declaring aggregate pointer variables,
> > majority of the call
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virnetdevip.c | 95
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virnetdevveth.c | 12
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virnuma.c | 79
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOFREE macro for declaring scalar variables, majority
of the VIR_FREE calls can be dropped, which in turn leads to
getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util/virpidfile.c | 185
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar
---
src/util
the source module into
the header.
When a variable of type virPerfPtr is declared using VIR_AUTOPTR,
the function virPerfFree will be run automatically on it when it
goes out of scope.
This commit also adds an intermediate typedef for virPerf
type for use with the cleanup macros.
Signed-off-by: Sukrit
1 - 100 of 322 matches
Mail list logo