From nobody Mon Feb 9 13:36:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571920636; cv=none; d=zoho.com; s=zohoarc; b=VS8CCnqQ2GkfxoenMQworJQMTdp/F14d+a6jJlFEFYTxE1JzLMPkaRlQOoqNSulTxmE2LAULbpSCBNAdqfKziLknUh6ql6A6XCLXpwN44kcR2mtPjB0MRUCJLPqEKbDFPhmfxXfLLEx4KbCKLLjsd+xy2r991t56uiXcmRq0EDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571920636; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DFQaK5/n1kPltuUs42oncHhJsQAMmaOUvm0QyimHp9g=; b=C5GTUH6OrVbrmPJ5C97Naw/pH8AcUp9DipsSf1NYxFpR8jGuv3wWvkoZN6RPBOOXBPRQgzFTCpuzdFHH+dboRCdrv1om2HdKPILKIAkHvDwSfzIzd1ieENq2MKxOYQcWhEsQXmlj74WS2uCiIyLDalyH20rVUshJmDpFZNSZS0U= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571920636302152.63763199561345; Thu, 24 Oct 2019 05:37:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-k5hzfv6oMKGmI8o7NvURgw-1; Thu, 24 Oct 2019 08:35:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BE99800D69; Thu, 24 Oct 2019 12:35:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA7026062B; Thu, 24 Oct 2019 12:35:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7B7704EE7E; Thu, 24 Oct 2019 12:35:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9OCZAlH004517 for ; Thu, 24 Oct 2019 08:35:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F0511001B33; Thu, 24 Oct 2019 12:35:10 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9CBD10027A1; Thu, 24 Oct 2019 12:35:06 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 1B371113294C; Thu, 24 Oct 2019 14:34:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571920635; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DFQaK5/n1kPltuUs42oncHhJsQAMmaOUvm0QyimHp9g=; b=MWsu7xrxh3I2FjasGrzzcSJOQFUW/i/Zy9O78s/EK5YIRBiedsHkPS7PwME0SPfpZSEfxg Hg/j/KzchlfVzY6Q5zUDx/U3XBdcPaWA9Isr/q7kpVDtVfqXfbgu1vX0Dxy0wf3p4FFUqy HMWwlqWppgo4KtRokr2yVx5fFt7MVqQ= From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 24 Oct 2019 14:34:49 +0200 Message-Id: <20191024123458.13505-11-armbru@redhat.com> In-Reply-To: <20191024123458.13505-1-armbru@redhat.com> References: <20191024123458.13505-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 10/19] qapi: Simplify how qmp_dispatch() deals with QCO_NO_SUCCESS_RESP X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: k5hzfv6oMKGmI8o7NvURgw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster --- qapi/qmp-dispatch.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index a69d5b5a96..d1643fe37a 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -151,31 +151,31 @@ QDict *qmp_dispatch(QmpCommandList *cmds, QObject *re= quest, args =3D qdict_get_qdict(dict, "arguments"); qobject_ref(args); } - cmd->fn(args, &ret, &err);=20 + qobject_unref(args); if (err) { - ; - } else if (cmd->options & QCO_NO_SUCCESS_RESP) { + goto out; + } + + if (cmd->options & QCO_NO_SUCCESS_RESP) { g_assert(!ret); + return NULL; } else if (!ret) { /* TODO turn into assertion */ ret =3D QOBJECT(qdict_new()); } =20 - qobject_unref(args); - out: + assert(!err !=3D !ret); + if (err) { rsp =3D qmp_error_response(err); - } else if (ret) { + } else { rsp =3D qdict_new(); qdict_put_obj(rsp, "return", ret); - } else { - /* Can only happen for commands with QCO_NO_SUCCESS_RESP */ - rsp =3D NULL; } =20 - if (rsp && id) { + if (id) { qdict_put_obj(rsp, "id", qobject_ref(id)); } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list