Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCaw4-0007tj-Qj for qemu-devel@nongnu.org; Mon, 23 Nov 2009 10:34:40 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCaw0-0007ro-36 for qemu-devel@nongnu.org; Mon, 23 Nov 2009 10:34:40 -0500 Received: from [199.232.76.173] (port=46866 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCavz-0007rd-O5 for qemu-devel@nongnu.org; Mon, 23 Nov 2009 10:34:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18013) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCavz-0004zN-2r for qemu-devel@nongnu.org; Mon, 23 Nov 2009 10:34:35 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nANFYXp6029150 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Nov 2009 10:34:34 -0500 From: Markus Armbruster Subject: Re: [Qemu-devel] [PATCH 11/17] block: Convert bdrv_info() to QObject References: <1258489944-12159-1-git-send-email-lcapitulino@redhat.com> <1258489944-12159-12-git-send-email-lcapitulino@redhat.com> <20091123112123.06338f41@doriath> Date: Mon, 23 Nov 2009 16:34:31 +0100 In-Reply-To: <20091123112123.06338f41@doriath> (Luiz Capitulino's message of "Mon, 23 Nov 2009 11:21:23 -0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel@nongnu.org Luiz Capitulino writes: > On Fri, 20 Nov 2009 15:06:26 +0100 > Markus Armbruster wrote: > >> Luiz Capitulino writes: [...] >> > diff --git a/block.c b/block.c >> > index 6fdabff..fc4e2f2 100644 >> > --- a/block.c >> > +++ b/block.c [...] >> > - monitor_printf(mon, " removable=%d", bs->removable); >> > - if (bs->removable) { >> > - monitor_printf(mon, " locked=%d", bs->locked); >> > - } >> > + >> > + bs_obj = qobject_from_jsonf("{ 'device': %s, 'type': %s, " >> > + "'removable': %i, 'locked': %i }", >> > + bs->device_name, type, bs->removable, >> > + bs->locked); >> > + assert(bs_obj != NULL); >> >> Failure modes of qobject_from_jsonf()? I'm asking because depending on >> the answer assert() may not be appropriate here. > > As far as I know it will fail on wrong syntax. In that case, assert() catches a programming error. That's fine.