qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	qemu trival <qemu-trivial@nongnu.org>,
	Pan Nengyuan <pannengyuan@huawei.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	QEMU <qemu-devel@nongnu.org>, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] qom/object: Comment to use g_slist_free on object_class_get_list result
Date: Fri, 28 Feb 2020 11:08:58 +0100	[thread overview]
Message-ID: <cc93fc81-3e4d-b8d0-afa7-2c35ac502785@redhat.com> (raw)
In-Reply-To: <CAJ+F1CL-fbX=dXpopMMT1o-WH1JhrqrzpM55J9cGoGDNpDq=AQ@mail.gmail.com>

On 2/28/20 11:06 AM, Marc-André Lureau wrote:
> Hi
> 
> On Fri, Feb 28, 2020 at 10:47 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>>
>> On Thu, Feb 27, 2020 at 08:09:42PM +0100, Philippe Mathieu-Daudé wrote:
>>> Document the list returned by object_class_get_list() must be
>>> released with g_slist_free() to avoid memory leaks.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>>   include/qom/object.h | 6 ++++++
>>>   1 file changed, 6 insertions(+)
>>>
>>> diff --git a/include/qom/object.h b/include/qom/object.h
>>> index 29546496c1..5517b56508 100644
>>> --- a/include/qom/object.h
>>> +++ b/include/qom/object.h
>>> @@ -984,6 +984,9 @@ void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
>>>    * @include_abstract: Whether to include abstract classes.
>>>    *
>>>    * Returns: A singly-linked list of the classes in reverse hashtable order.
>>> + *
>>> + * The returned list must be released with g_slist_free()
>>> + * when no longer required.
>>
>> I'd suggest
>>
>>    "The returned list, but not its elements, must be released with
>>     g_slist_free() or g_autoptr when no longer required"
> 
> As gobject-introspection annotations: "Returns: (transfer container)
> (element-type ObjectClass): A list of #ObjectClass"

Are you suggesting to replace "Returns: A singly-linked list of the 
classes in reverse hashtable order." by the line you quoted?

> 
>>
>>>    */
>>>   GSList *object_class_get_list(const char *implements_type,
>>>                                 bool include_abstract);
>>> @@ -995,6 +998,9 @@ GSList *object_class_get_list(const char *implements_type,
>>>    *
>>>    * Returns: A singly-linked list of the classes in alphabetical
>>>    * case-insensitive order.
>>> + *
>>> + * The returned list must be released with g_slist_free()
>>> + * when no longer required.
>>>    */
>>>   GSList *object_class_get_list_sorted(const char *implements_type,
>>>                                 bool include_abstract);
>>> --
>>> 2.21.1
>>>
>>>
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
>> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
>> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
>>
>>
> 
> 



  reply	other threads:[~2020-02-28 10:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 19:09 [PATCH] qom/object: Comment to use g_slist_free on object_class_get_list result Philippe Mathieu-Daudé
2020-02-28  9:46 ` Daniel P. Berrangé
2020-02-28 10:06   ` Marc-André Lureau
2020-02-28 10:08     ` Philippe Mathieu-Daudé [this message]
2020-02-28 10:35       ` Marc-André Lureau
2020-02-28 10:35     ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cc93fc81-3e4d-b8d0-afa7-2c35ac502785@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pannengyuan@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).