From nobody Fri May 16 00:54:05 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1502713985724559.3786057636648; Mon, 14 Aug 2017 05:33:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DECAB9D503; Mon, 14 Aug 2017 12:33:03 +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 A749D7FCC6; Mon, 14 Aug 2017 12:33:03 +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 58BB7180BA80; Mon, 14 Aug 2017 12:33:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v7ECWsLH015533 for ; Mon, 14 Aug 2017 08:32:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86AF16872B; Mon, 14 Aug 2017 12:32:54 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FF8868738 for ; Mon, 14 Aug 2017 12:32:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DECAB9D503 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 14 Aug 2017 14:32:42 +0200 Message-Id: <78ac13860ac92dc93c1a349a352de3d8e92ce8ce.1502713940.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/8] conf: cleanup virDomainChrSourceDef parsing 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 14 Aug 2017 12:33:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The @remaining variable is leftover from old code and it's not used anymore. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 37aa975eca..528d11c17d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10793,9 +10793,9 @@ virDomainChrDefParseTargetXML(virDomainChrDefPtr de= f, =20 /* Parse the source half of the XML definition for a character device, * where node is the first element of node->children of the parent - * element. def->type must already be valid. Return -1 on failure, - * otherwise the number of ignored children (this intentionally skips - * , which is used by but not ). */ + * element. def->type must already be valid. + * + * Return -1 on failure, 0 on success. */ static int virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, xmlNodePtr cur, unsigned int flags, @@ -10804,6 +10804,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDef= Ptr def, virSecurityLabelDefPtr* vmSeclabels, int nvmSeclabels) { + int ret =3D -1; char *bindHost =3D NULL; char *bindService =3D NULL; char *connectHost =3D NULL; @@ -10819,7 +10820,6 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDef= Ptr def, char *append =3D NULL; char *haveTLS =3D NULL; char *tlsFromConfig =3D NULL; - int remaining =3D 0; =20 while (cur !=3D NULL) { if (cur->type =3D=3D XML_ELEMENT_NODE) { @@ -10912,8 +10912,6 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDef= Ptr def, } else if (virXMLNodeNameEqual(cur, "protocol")) { if (!protocol) protocol =3D virXMLPropString(cur, "type"); - } else { - remaining++; } } cur =3D cur->next; @@ -11099,6 +11097,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDef= Ptr def, goto error; } =20 + ret =3D 0; cleanup: VIR_FREE(mode); VIR_FREE(protocol); @@ -11114,11 +11113,10 @@ virDomainChrSourceDefParseXML(virDomainChrSourceD= efPtr def, VIR_FREE(haveTLS); VIR_FREE(tlsFromConfig); =20 - return remaining; + return ret; =20 error: virDomainChrSourceDefClear(def); - remaining =3D -1; goto cleanup; } =20 @@ -13895,7 +13893,6 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr = xmlopt, xmlNodePtr cur; virDomainRedirdevDefPtr def; char *bus =3D NULL, *type =3D NULL; - int remaining; =20 if (VIR_ALLOC(def) < 0) return NULL; @@ -13929,11 +13926,9 @@ virDomainRedirdevDefParseXML(virDomainXMLOptionPtr= xmlopt, =20 cur =3D node->children; /* boot gets parsed in virDomainDeviceInfoParseXML - * source gets parsed in virDomainChrSourceDefParseXML - * we don't know any of the elements that might remain */ - remaining =3D virDomainChrSourceDefParseXML(def->source, cur, flags, - NULL, NULL, NULL, 0); - if (remaining < 0) + * source gets parsed in virDomainChrSourceDefParseXML */ + if (virDomainChrSourceDefParseXML(def->source, cur, flags, + NULL, NULL, NULL, 0) < 0) goto error; =20 if (def->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_SPICEVMC) --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list