From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfKJq-0001iP-U6 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 16:41:58 -0500 Received: from [199.232.76.173] (port=37832 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfKJq-0001iD-Hi for qemu-devel@nongnu.org; Wed, 10 Feb 2010 16:41:58 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfKJp-0001vq-0t for qemu-devel@nongnu.org; Wed, 10 Feb 2010 16:41:58 -0500 Received: from mail-iw0-f194.google.com ([209.85.223.194]:60256) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfKJo-0001uW-Nf for qemu-devel@nongnu.org; Wed, 10 Feb 2010 16:41:56 -0500 Received: by mail-iw0-f194.google.com with SMTP id 32so907977iwn.14 for ; Wed, 10 Feb 2010 13:41:55 -0800 (PST) Message-ID: <4B732821.7030204@codemonkey.ws> Date: Wed, 10 Feb 2010 15:41:53 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] qjson: Improve debugging References: <1265655690-6628-1-git-send-email-lcapitulino@redhat.com> <1265655690-6628-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1265655690-6628-2-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org On 02/08/2010 01:01 PM, Luiz Capitulino wrote: > Add an assert() to qobject_from_jsonf() to assure that the returned > QObject is not NULL. Currently this is duplicated in the callers. > > Signed-off-by: Luiz Capitulino > Applied all. Thanks. Regards, Anthony Liguori > --- > qjson.c | 5 +++++ > 1 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/qjson.c b/qjson.c > index 9ad8a91..483c667 100644 > --- a/qjson.c > +++ b/qjson.c > @@ -53,6 +53,10 @@ QObject *qobject_from_json(const char *string) > return qobject_from_jsonv(string, NULL); > } > > +/* > + * IMPORTANT: This function aborts on error, thus it must not > + * be used with untrusted arguments. > + */ > QObject *qobject_from_jsonf(const char *string, ...) > { > QObject *obj; > @@ -62,6 +66,7 @@ QObject *qobject_from_jsonf(const char *string, ...) > obj = qobject_from_jsonv(string,&ap); > va_end(ap); > > + assert(obj != NULL); > return obj; > } > >