From nobody Sun Feb 8 10:16:55 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506693431897129.9043340773602; Fri, 29 Sep 2017 06:57:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9838BC04AC4F; Fri, 29 Sep 2017 13:57:10 +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 6D9135C89A; Fri, 29 Sep 2017 13:57:10 +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 26AD8410B2; Fri, 29 Sep 2017 13:57:10 +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 v8TDVDZK032692 for ; Fri, 29 Sep 2017 09:31:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id D845BB32B5; Fri, 29 Sep 2017 13:31:13 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-1.phx2.redhat.com [10.3.117.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0FBCB32B0 for ; Fri, 29 Sep 2017 13:31:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9838BC04AC4F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Fri, 29 Sep 2017 09:31:08 -0400 Message-Id: <20170929133109.6782-2-jferlan@redhat.com> In-Reply-To: <20170929133109.6782-1-jferlan@redhat.com> References: <20170929133109.6782-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] nwfilter: Clean up virNWFilterDetermineMissingVarsRec returns 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 29 Sep 2017 13:57:11 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Rather than using loop break;'s in order to force a return of rc =3D -1, let's just return -1 immediately on the various error paths and then return 0 on the success path. Signed-off-by: John Ferlan Reviewed-by: Erik Skultety --- src/nwfilter/nwfilter_gentech_driver.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 6758200b5..7a3d115ba 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -494,7 +494,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr fi= lter, virNWFilterDriverStatePtr driver) { virNWFilterObjPtr obj; - int rc =3D 0; + int rc; size_t i, j; virNWFilterDefPtr next_filter; virNWFilterDefPtr newNext_filter; @@ -515,15 +515,13 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr = filter, virNWFilterVarAccessPrint(rule->varAccess[j], &buf); if (virBufferError(&buf)) { virReportOOMError(); - rc =3D -1; - break; + return -1; } =20 val =3D virNWFilterVarValueCreateSimpleCopyValue("1"); if (!val) { virBufferFreeAndReset(&buf); - rc =3D -1; - break; + return -1; } =20 varAccess =3D virBufferContentAndReset(&buf); @@ -532,21 +530,16 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr = filter, VIR_FREE(varAccess); } } - if (rc) - break; } else if (inc) { VIR_DEBUG("Following filter %s", inc->filterref); if (!(obj =3D virNWFilterObjListFindInstantiateFilter(driver->= nwfilters, - inc->filte= rref))) { - rc =3D -1; - break; - } + inc->filte= rref))) + return -1; =20 /* create a temporary hashmap for depth-first tree traversal */ if (!(tmpvars =3D virNWFilterCreateVarsFrom(inc->params, vars)= )) { - rc =3D -1; virNWFilterObjUnlock(obj); - break; + return -1; } =20 next_filter =3D virNWFilterObjGetDef(obj); @@ -571,10 +564,10 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr = filter, =20 virNWFilterObjUnlock(obj); if (rc < 0) - break; + return -1; } } - return rc; + return 0; } =20 =20 --=20 2.13.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list