[libvirt] [GSoC] Introduction

2018-04-27 Thread Sukrit Bhatnagar
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

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-24 Thread Sukrit Bhatnagar
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

Re: [libvirt] [PATCH v1 01/18] add macros for implementing automatic cleanup functionality

2018-06-06 Thread Sukrit Bhatnagar
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

[libvirt] [GSoC] Code design for scalar and external types

2018-06-09 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 09/21] util: authconfig: remove redundant include directive

2018-06-07 Thread Sukrit Bhatnagar
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 +++

[libvirt] [PATCH v1 12/21] util: auth: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 14/21] util: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 08/21] util: authconfig: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 05/21] util: fcp: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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(-)

[libvirt] [PATCH v1 11/21] util: auth: remove redundant include directive

2018-06-07 Thread Sukrit Bhatnagar
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 @@

[libvirt] [PATCH v1 17/21] util: json: use VIR_AUTOPTR for aggregate types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 13/21] util: auth: use VIR_AUTOPTR for aggregate types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 16/21] util: json: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 04/21] util: audit: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 07/21] util: filecache: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 06/21] util: eventpoll: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 10/21] util: authconfig: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 20/21] util: bitmap: remove redundant include directive

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 21/21] util: bitmap: use VIR_AUTOPTR for aggregate types

2018-06-07 Thread Sukrit Bhatnagar
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(-)

[libvirt] [PATCH v1 15/21] util: json: remove redundant include directive

2018-06-07 Thread Sukrit Bhatnagar
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 @@

[libvirt] [PATCH v1 19/21] util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 18/21] util: identity: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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,

[libvirt] [PATCH v1 03/21] util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 01/21] add macros for implementing automatic cleanup functionality

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 00/21] use GCC's cleanup attribute in src/util

2018-06-07 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 02/21] util: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-06-07 Thread Sukrit Bhatnagar
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(-)

Re: [libvirt] [GSoC] Code design for scalar and external types

2018-06-11 Thread Sukrit Bhatnagar
; > 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, > &

[libvirt] [RFC 1/4] add macros for implementing automatic cleanup functionality

2018-05-29 Thread Sukrit Bhatnagar
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

[libvirt] [RFC 0/4] add automatic cleanup functionality in some files

2018-05-29 Thread Sukrit Bhatnagar
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

[libvirt] [RFC 3/4] add automatic cleanup support in src/util/virauthconfig.c

2018-05-29 Thread Sukrit Bhatnagar
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

[libvirt] [RFC 4/4] add automatic cleanup support in src/util/virauth.c

2018-05-29 Thread Sukrit Bhatnagar
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

[libvirt] [RFC 2/4] add automatic cleanup support in src/util/virarptable.c

2018-05-29 Thread Sukrit Bhatnagar
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

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-29 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 02/18] use VIR_AUTOFREE in src/util/virarptable.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 01/18] add macros for implementing automatic cleanup functionality

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 06/18] use VIR_AUTOFREE in src/util/viraudit.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 03/18] use VIR_AUTOFREE in src/util/virauth.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 08/18] use VIR_AUTOFREE in src/util/vircgroup.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 05/18] use VIR_AUTOFREE in src/util/iohelper.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 16/18] use VIR_AUTOFREE in src/util/virfilecache.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 00/18] use VIR_AUTOFREE in src/util

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 04/18] use VIR_AUTOFREE in src/util/virauthconfig.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 17/18] use VIR_AUTOFREE in src/util/virfirewall.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 09/18] use VIR_AUTOFREE in src/util/virfcp.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 07/18] use VIR_AUTOFREE in src/util/virbuffer.c

2018-06-04 Thread Sukrit Bhatnagar
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

Re: [libvirt] [PATCH v1 01/18] add macros for implementing automatic cleanup functionality

2018-06-06 Thread Sukrit Bhatnagar
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: > >

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 10/18] use VIR_AUTOFREE in src/util/virdnsmasq.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 15/18] use VIR_AUTOFREE in src/util/virconf.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 13/18] use VIR_AUTOFREE in src/util/virfdstream.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 18/18] use VIR_AUTOFREE in src/util/virhook.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 12/18] use VIR_AUTOFREE in src/util/virdbus.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 11/18] use VIR_AUTOFREE in src/util/vireventpoll.c

2018-06-04 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 14/18] use VIR_AUTOFREE in src/util/virfile.c

2018-06-04 Thread Sukrit Bhatnagar
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

Re: [libvirt] [GSoC] Design ideas for implementing cleanup attribute

2018-05-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 06/35] util: string: introduce typedef for string

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 03/35] cfg.mk: correct spacing between type and asterisk in VIR_AUTOFREE

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 10/35] util: command: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 11/35] util: command: use VIR_AUTOPTR for aggregate types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 18/35] util: authconfig: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 12/35] util: file: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-01 Thread Sukrit Bhatnagar
, 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

[libvirt] [PATCH v3 19/35] util: auth: remove redundant include directive

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 29/35] util: iohelper: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 24/35] util: json: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 17/35] util: authconfig: remove redundant include directive

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 20/35] util: auth: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 35/35] util: identity: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 14/35] util: file: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 07/35] util: string: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-01 Thread Sukrit Bhatnagar
, 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

[libvirt] [PATCH v3 04/35] cfg.mk: single variable declaration per line when using cleanup macro

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 09/35] util: command: remove redundant include directive

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 05/35] cfg.mk: no trailing semicolon at line invoking VIR_DEFINE_* cleanup macro

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 08/35] util: command: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-01 Thread Sukrit Bhatnagar
, 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

[libvirt] [PATCH v3 16/35] util: authconfig: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-01 Thread Sukrit Bhatnagar
, 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

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

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 15/35] util: file: use VIR_AUTOPTR for aggregate types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 02/35] cfg.mk: variable initialization when declared with cleanup macro

2018-07-01 Thread Sukrit Bhatnagar
-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

[libvirt] [PATCH v3 01/35] util: alloc: add macros for implementing automatic cleanup functionality

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 28/35] util: bitmap: use VIR_AUTOPTR for aggregate types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 27/35] util: bitmap: remove redundant include directive

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 23/35] util: json: remove redundant include directive

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 31/35] util: audit: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 13/35] util: file: remove redundant include directive

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 34/35] util: filecache: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 21/35] util: auth: use VIR_AUTOPTR for aggregate types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 26/35] util: bitmap: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-01 Thread Sukrit Bhatnagar
, 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

[libvirt] [PATCH v3 33/35] util: eventpoll: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 22/35] util: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-01 Thread Sukrit Bhatnagar
, 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

[libvirt] [PATCH v3 25/35] util: json: use VIR_AUTOPTR for aggregate types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 32/35] util: fcp: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v3 30/35] util: arptable: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-01 Thread Sukrit Bhatnagar
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

Re: [libvirt] [GSoC] Code design for scalar and external types

2018-06-21 Thread Sukrit Bhatnagar
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

Re: [libvirt] [PATCH v1 16/32] util: netdevmacvlan: use VIR_AUTOPTR for aggregate types

2018-08-03 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 12/32] util: netdevip: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 20/32] util: netdevveth: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 24/32] util: numa: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 28/32] util: pidfile: use VIR_AUTOFREE instead of VIR_FREE for scalar types

2018-07-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 23/32] util: netlink: use VIR_AUTOPTR for aggregate types

2018-07-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 21/32] util: netdevveth: use VIR_AUTOPTR for aggregate types

2018-07-28 Thread Sukrit Bhatnagar
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

[libvirt] [PATCH v1 26/32] util: perf: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC

2018-07-28 Thread Sukrit Bhatnagar
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   2   3   4   >