From nobody Thu May 2 14:38:28 2024 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 1502908215317125.27674716044442; Wed, 16 Aug 2017 11:30:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A318DF23; Wed, 16 Aug 2017 18:30:13 +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 B54A4627D9; Wed, 16 Aug 2017 18:30:12 +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 75AEA3FC73; Wed, 16 Aug 2017 18:30:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v7GIU9Z6027020 for ; Wed, 16 Aug 2017 14:30:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 463626016F; Wed, 16 Aug 2017 18:30:09 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-181.phx2.redhat.com [10.3.116.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D2EB5C7C1 for ; Wed, 16 Aug 2017 18:30:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A318DF23 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: John Ferlan To: libvir-list@redhat.com Date: Wed, 16 Aug 2017 14:29:56 -0400 Message-Id: <20170816182956.25586-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] network: Use @nnames instead of @got 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 16 Aug 2017 18:30:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To make it clearer, let's use @nnames instead of @got for counting the names in the @names array. Keeps things consistent and clear. Signed-off-by: John Ferlan --- NB: Be sure you're tree is up to date before attempting to apply ;-) src/conf/virnetworkobj.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 918ef44..b16844d 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1444,9 +1444,9 @@ struct virNetworkObjListGetHelperData { virConnectPtr conn; virNetworkObjListFilter filter; char **names; + int nnames; int maxnames; bool active; - int got; bool error; }; =20 @@ -1462,7 +1462,7 @@ virNetworkObjListGetHelper(void *payload, return 0; =20 if (data->maxnames >=3D 0 && - data->got =3D=3D data->maxnames) + data->nnames =3D=3D data->maxnames) return 0; =20 virObjectLock(obj); @@ -1474,11 +1474,11 @@ virNetworkObjListGetHelper(void *payload, if ((data->active && virNetworkObjIsActive(obj)) || (!data->active && !virNetworkObjIsActive(obj))) { if (data->names && - VIR_STRDUP(data->names[data->got], obj->def->name) < 0) { + VIR_STRDUP(data->names[data->nnames], obj->def->name) < 0) { data->error =3D true; goto cleanup; } - data->got++; + data->nnames++; } =20 cleanup: @@ -1498,8 +1498,8 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets, int ret =3D -1; =20 struct virNetworkObjListGetHelperData data =3D { - .conn =3D conn, .filter =3D filter, .names =3D names, - .maxnames =3D maxnames, .active =3D active, .got =3D 0, .error =3D= false}; + .conn =3D conn, .filter =3D filter, .names =3D names, .nnames =3D = 0, + .maxnames =3D maxnames, .active =3D active, .error =3D false}; =20 virObjectLock(nets); virHashForEach(nets->objs, virNetworkObjListGetHelper, &data); @@ -1508,11 +1508,11 @@ virNetworkObjListGetNames(virNetworkObjListPtr nets, if (data.error) goto cleanup; =20 - ret =3D data.got; + ret =3D data.nnames; cleanup: if (ret < 0) { - while (data.got) - VIR_FREE(data.names[--data.got]); + while (data.nnames) + VIR_FREE(data.names[--data.nnames]); } return ret; } @@ -1525,14 +1525,14 @@ virNetworkObjListNumOfNetworks(virNetworkObjListPtr= nets, virConnectPtr conn) { struct virNetworkObjListGetHelperData data =3D { - .conn =3D conn, .filter =3D filter, .names =3D NULL, - .maxnames =3D -1, .active =3D active, .got =3D 0, .error =3D false= }; + .conn =3D conn, .filter =3D filter, .names =3D NULL, .nnames =3D 0, + .maxnames =3D -1, .active =3D active, .error =3D false}; =20 virObjectLock(nets); virHashForEach(nets->objs, virNetworkObjListGetHelper, &data); virObjectUnlock(nets); =20 - return data.got; + return data.nnames; } =20 =20 --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list