Received: from eggs.gnu.org ([2001:4830:134:3::10]:53067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftBPu-0000hV-WF for qemu-devel@nongnu.org; Fri, 24 Aug 2018 08:42:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ftBPq-0003YY-8K for qemu-devel@nongnu.org; Fri, 24 Aug 2018 08:42:18 -0400 From: Markus Armbruster References: <20180817171932.31976-1-marcandre.lureau@redhat.com> <20180817171932.31976-2-marcandre.lureau@redhat.com> <87in40b3fc.fsf@dusky.pond.sub.org> <87wosg80ic.fsf@dusky.pond.sub.org> Date: Fri, 24 Aug 2018 14:37:05 +0200 In-Reply-To: (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Fri, 24 Aug 2018 14:15:57 +0200") Message-ID: <8760007xfy.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] qdict: add qdict_steal() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: Kevin Wolf , QEMU , "Dr. David Alan Gilbert" , "open list:Block layer core" , Max Reitz Marc-Andr=C3=A9 Lureau writes: > Hi > On Fri, Aug 24, 2018 at 1:30 PM Markus Armbruster wro= te: >> >> Marc-Andr=C3=A9 Lureau writes: >> >> > Hi >> > >> > On Fri, Aug 24, 2018 at 10:05 AM Markus Armbruster = wrote: >> >> >> >> Marc-Andr=C3=A9 Lureau 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".