* [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo
@ 2014-10-26 18:55 Uma Sharma
2014-10-27 9:47 ` Ian Campbell
2014-10-27 10:06 ` Andrew Cooper
0 siblings, 2 replies; 4+ messages in thread
From: Uma Sharma @ 2014-10-26 18:55 UTC (permalink / raw)
To: Wei.Liu2; +Cc: George.Dunlap, Ian.Jackson, Ian.Campbell, xen-devel
This patch simplifies the call to dispose for libxl_dominfo *info.
_dispose was called multiple times in tools/libxl/xl_cmdimpl.c
IDL generated libxl types should be used only after calling the init
function.
Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
--
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 5325a52..9a6ceb3 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4375,12 +4375,8 @@ int main_list(int argc, char **argv)
list_domains_details(info, nb_domain);
else
list_domains(verbose, context, 0 /* claim */, numa, info, nb_domain);
-
- if (info_free)
- libxl_dominfo_list_free(info, nb_domain);
- else
- libxl_dominfo_dispose(info);
-
+
+ libxl_dominfo_list_free(info, nb_domain);
return 0;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo
2014-10-26 18:55 [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo Uma Sharma
@ 2014-10-27 9:47 ` Ian Campbell
2014-10-27 10:06 ` Andrew Cooper
1 sibling, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2014-10-27 9:47 UTC (permalink / raw)
To: Uma Sharma; +Cc: George.Dunlap, Ian.Jackson, Wei.Liu2, xen-devel
On Mon, 2014-10-27 at 00:25 +0530, Uma Sharma wrote:
> This patch simplifies the call to dispose for libxl_dominfo *info.
> _dispose was called multiple times in tools/libxl/xl_cmdimpl.c
> IDL generated libxl types should be used only after calling the init
> function.
>
> Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
> --
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 5325a52..9a6ceb3 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -4375,12 +4375,8 @@ int main_list(int argc, char **argv)
> list_domains_details(info, nb_domain);
> else
> list_domains(verbose, context, 0 /* claim */, numa, info, nb_domain);
> -
> - if (info_free)
> - libxl_dominfo_list_free(info, nb_domain);
> - else
> - libxl_dominfo_dispose(info);
> -
> +
> + libxl_dominfo_list_free(info, nb_domain);
I don't think this is right, libxl_dominfo_list_free will dispose each
of the array members and then free the memory corresponding to the array
itself. But when info_free is false info is a pointer to a static buffer
on the stack, not to a dynamically allocated array.
Even if the change is correct, it doesn't seem to correspond to the
commit message.
Ian.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo
2014-10-26 18:55 [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo Uma Sharma
2014-10-27 9:47 ` Ian Campbell
@ 2014-10-27 10:06 ` Andrew Cooper
2014-10-27 21:41 ` Uma Sharma
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cooper @ 2014-10-27 10:06 UTC (permalink / raw)
To: Uma Sharma, Wei.Liu2; +Cc: George.Dunlap, Ian.Jackson, Ian.Campbell, xen-devel
On 26/10/14 18:55, Uma Sharma wrote:
> This patch simplifies the call to dispose for libxl_dominfo *info.
> _dispose was called multiple times in tools/libxl/xl_cmdimpl.c
> IDL generated libxl types should be used only after calling the init
> function.
>
> Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
> --
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 5325a52..9a6ceb3 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -4375,12 +4375,8 @@ int main_list(int argc, char **argv)
> list_domains_details(info, nb_domain);
> else
> list_domains(verbose, context, 0 /* claim */, numa, info, nb_domain);
> -
> - if (info_free)
> - libxl_dominfo_list_free(info, nb_domain);
> - else
> - libxl_dominfo_dispose(info);
> -
> +
> + libxl_dominfo_list_free(info, nb_domain);
Unrelated to the code in the patch, observe from the first - and first +
that you have introduced trailing whitespace with this change, which
should be avoided.
If you can, configure your editor to highlight trailing whitespace.
~Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo
2014-10-27 10:06 ` Andrew Cooper
@ 2014-10-27 21:41 ` Uma Sharma
0 siblings, 0 replies; 4+ messages in thread
From: Uma Sharma @ 2014-10-27 21:41 UTC (permalink / raw)
To: Andrew Cooper
Cc: George Dunlap, Ian Jackson, Wei Liu, Ian Campbell,
xen-devel@lists.xen.org
Apologies for the wrong commit message. I will look into the patch
again and try to improve it.
Regards,
Uma Sharma
On Mon, Oct 27, 2014 at 3:36 PM, Andrew Cooper
<andrew.cooper3@citrix.com> wrote:
> On 26/10/14 18:55, Uma Sharma wrote:
>> This patch simplifies the call to dispose for libxl_dominfo *info.
>> _dispose was called multiple times in tools/libxl/xl_cmdimpl.c
>> IDL generated libxl types should be used only after calling the init
>> function.
>>
>> Signed-off-by: Uma Sharma <uma.sharma523@gmail.com>
>> --
>> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
>> index 5325a52..9a6ceb3 100644
>> --- a/tools/libxl/xl_cmdimpl.c
>> +++ b/tools/libxl/xl_cmdimpl.c
>> @@ -4375,12 +4375,8 @@ int main_list(int argc, char **argv)
>> list_domains_details(info, nb_domain);
>> else
>> list_domains(verbose, context, 0 /* claim */, numa, info, nb_domain);
>> -
>> - if (info_free)
>> - libxl_dominfo_list_free(info, nb_domain);
>> - else
>> - libxl_dominfo_dispose(info);
>> -
>> +
>> + libxl_dominfo_list_free(info, nb_domain);
>
> Unrelated to the code in the patch, observe from the first - and first +
> that you have introduced trailing whitespace with this change, which
> should be avoided.
>
> If you can, configure your editor to highlight trailing whitespace.
>
> ~Andrew
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-27 21:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-26 18:55 [OPW PATCH] tools/xl:Making _dispose function simplicity for libxl_dominfo Uma Sharma
2014-10-27 9:47 ` Ian Campbell
2014-10-27 10:06 ` Andrew Cooper
2014-10-27 21:41 ` Uma Sharma
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.