Received: from eggs.gnu.org ([140.186.70.92]:53309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWCZN-0005DO-W2 for qemu-devel@nongnu.org; Mon, 13 Jun 2011 15:13:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWCZM-0002xr-5H for qemu-devel@nongnu.org; Mon, 13 Jun 2011 15:13:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWCZL-0002xa-Th for qemu-devel@nongnu.org; Mon, 13 Jun 2011 15:13:04 -0400 Date: Mon, 13 Jun 2011 16:12:49 -0300 From: Luiz Capitulino Message-ID: <20110613161249.5ac80191@doriath> In-Reply-To: <1307140399-9023-11-git-send-email-mdroth@linux.vnet.ibm.com> References: <1307140399-9023-1-git-send-email-mdroth@linux.vnet.ibm.com> <1307140399-9023-11-git-send-email-mdroth@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2][ 10/21] qapi: add QMP input visiter List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com, qemu-devel@nongnu.org, Jes.Sorensen@redhat.com On Fri, 3 Jun 2011 17:33:08 -0500 Michael Roth wrote: > +static void qmp_input_type_int(Visiter *v, int64_t *obj, const char *name, Error **errp) > +{ > + QmpInputVisiter *qiv = to_qiv(v); > + QObject *qobj = qmp_input_get_object(qiv, name); > + > + if (!qobj || qobject_type(qobj) != QTYPE_QINT) { > + error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, "integer"); > + return; > + } > + > + *obj = qint_get_int(qobject_to_qint(qobj)); Let me warn you for an error I just got: if 'name' is NULL and the if test is true, then error_set() will segfault, because 'name' must not be NULL. So either, we always pass 'name' in the generated code or we automatically build a new string if 'name' is NULL.