From nobody Mon Feb 9 19:54:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1555344174; cv=none; d=zoho.com; s=zohoarc; b=APPKco9UTwSyEwu6jMf/8eGXthGLHPgLEmkdwb9seiV3UsFt+4aMjNI2X8mMjJOxwzclxzCtWxChBHm+ZQznDCWBRQ69y3FAWVQRX9ZF39fD2ITSHiie1fiZ8SuKvC2Z//aFDLomWy3ApxrKxMGBATJVTVcQGVGzL//jHXGatjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555344174; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=CXUkV0/RYC2j+yW/bzSmSwyn++sAILh8fwdLfnKRV+8=; b=GCkOjZsdFceTVFfteD7vp6oU3QnUlhnjeHZNqbQzP23+oAYGKp4ezz8gL6peuyxbWrsb6FPV51GOX7mSWeW7w2cRs2SEQ1TCkMZa3EU9NpqM5L3LC5xQUZnuBX+exmjZmX/EUrYm7vOiP8xjf5aQB82JnL+5utC7DAtBP+Bn69s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555344174150974.5284072568851; Mon, 15 Apr 2019 09:02:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5CAC1307D933; Mon, 15 Apr 2019 16:02:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 34A285D9E2; Mon, 15 Apr 2019 16:02:52 +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 D6545181B9E2; Mon, 15 Apr 2019 16:02:51 +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 x3FG2POB003209 for ; Mon, 15 Apr 2019 12:02:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0F71D1001E89; Mon, 15 Apr 2019 16:02:25 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B5A41001947 for ; Mon, 15 Apr 2019 16:02:24 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 15 Apr 2019 18:02:02 +0200 Message-Id: <38178025870d94f31ad5a3ab5a4398b66f85d20a.1555344008.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/21] qemu: qapi: Optimize out some helper functions 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 15 Apr 2019 16:02:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virQEMUQAPISchemaTypeFromObject and virQEMUQAPISchemaTypeFromObject can be very easily folded into virQEMUQAPISchemaTraverseObject removing the need for the helpers. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_qapi.c | 45 ++++++-------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/src/qemu/qemu_qapi.c b/src/qemu/qemu_qapi.c index 5995e5006e..24dc340ef9 100644 --- a/src/qemu/qemu_qapi.c +++ b/src/qemu/qemu_qapi.c @@ -69,38 +69,6 @@ virQEMUQAPISchemaObjectGet(const char *field, } -static const char * -virQEMUQAPISchemaTypeFromObject(virJSONValuePtr obj) -{ - if (!obj) - return NULL; - - return virJSONValueObjectGetString(obj, "type"); -} - - -/** - * virQEMUQAPISchemaObjectGetType: - * @field: name of the object containing the requested type - * @name: name of the requested type - * @namefield: name of the object property holding @name - * @elem: QAPI schema entry JSON object - * - * Helper that selects the type of a QMP schema object member or it's vari= ant - * member. Returns the type string on success or NULL on error. - */ -static const char * -virQEMUQAPISchemaObjectGetType(const char *field, - const char *name, - const char *namefield, - virJSONValuePtr elem) -{ - virJSONValuePtr obj =3D virQEMUQAPISchemaObjectGet(field, name, namefi= eld, elem); - - return virQEMUQAPISchemaTypeFromObject(obj); -} - - static int virQEMUQAPISchemaTraverse(const char *baseName, char **query, @@ -115,7 +83,6 @@ virQEMUQAPISchemaTraverseObject(virJSONValuePtr cur, virJSONValuePtr *type) { virJSONValuePtr obj; - const char *querytype =3D NULL; const char *querystr =3D *query; char modifier =3D *querystr; @@ -123,20 +90,20 @@ virQEMUQAPISchemaTraverseObject(virJSONValuePtr cur, querystr++; if (modifier =3D=3D '+') { - querytype =3D virQEMUQAPISchemaObjectGetType("variants", - querystr, - "case", cur); + obj =3D virQEMUQAPISchemaObjectGet("variants", querystr, "case", c= ur); } else { obj =3D virQEMUQAPISchemaObjectGet("members", querystr, "name", cu= r); if (modifier =3D=3D '*' && !virJSONValueObjectHasKey(obj, "default")) return 0; - - querytype =3D virQEMUQAPISchemaTypeFromObject(obj); } - return virQEMUQAPISchemaTraverse(querytype, query + 1, schema, type); + if (!obj) + return 0; + + return virQEMUQAPISchemaTraverse(virJSONValueObjectGetString(obj, "typ= e"), + query + 1, schema, type); } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list