qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] qdict: add qdict_steal()


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 1/2] qdict: add qdict_steal()
Date: Fri, 24 Aug 2018 14:37:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Marc-André Lureau <address@hidden> writes:

> Hi
> On Fri, Aug 24, 2018 at 1:30 PM Markus Armbruster <address@hidden> wrote:
>>
>> Marc-André Lureau <address@hidden> writes:
>>
>> > Hi
>> >
>> > On Fri, Aug 24, 2018 at 10:05 AM Markus Armbruster <address@hidden> wrote:
>> >>
>> >> Marc-André Lureau <address@hidden> writes:
[...]
>> >> > @@ -406,6 +406,28 @@ void qdict_del(QDict *qdict, const char *key)
>> >> >      }
>> >> >  }
>> >> >
>> >> > +/**
>> >> > + * qdict_steal(): Steal a 'key:value' pair from the dictionary
>> >>
>> >> "Steal" is cute, but perhaps qdict_get_and_del() would be clearer.
>> >
>> > "steal" is common in glib. I don't mind renaming.
>>
>> Hmm.  I found g_hash_table_steal(), but it's a bit different: it
>> "Removes a key and its associated value from a GHashTable without
>> calling the key and value destroy functions" (that part seems close
>> enough), but returns a bool rather than the value.  Feels like sub-par
>> design to me.  Is this the precedence you have in mind?
>
> They are many more _steal* functions in the GNOME libraries (search
> with devhelp): the general idea is to remove an object from the owner
> (without destrying), and return that object/reference.

Alright, I don't mind calling it "steal".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]