From nobody Sun Feb 8 14:57:02 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=1563015557; cv=none; d=zoho.com; s=zohoarc; b=fEeZgFqliqivKMYaXXATSaL8N/pn6OUrtT2CjDD9Zl9b4QUS3jz8QRZ7yE322raW2sTYp30HVNrs8SDjM5Whtlql3G4JvfVBobcaDJcMCJdRWvuqt3h3EbKgLa1fTUQoW9uC/JQbTgvWr+/21ySmwptxkTYvhMe2VW0ERl5VvPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563015557; 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:ARC-Authentication-Results; bh=EN3rCNfzTzepjCEsN8xHhBthm8BKk4y1rfhrbjpzVE0=; b=fqx4urPkocZX+Z6t3/ERRq5SrBK0xTgGzxLyJECzkxKMbvORdbaZRnDpwa9KyaPc88KL4An3V6aIhDySGPurE8ZSyubjWUou6qMx1n0hrOzHQoSHsndOnXEAU1g7jGV9cJcpU0agkG4zUWVU+XiIH21eOMe1BdhzgamuovMey8E= 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 1563015557184906.1403067253087; Sat, 13 Jul 2019 03:59:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 689B32F8BDC; Sat, 13 Jul 2019 10:59:15 +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 4837F1001B13; Sat, 13 Jul 2019 10:59:15 +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 0FEF68E1F; Sat, 13 Jul 2019 10:59:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6DAwonM010229 for ; Sat, 13 Jul 2019 06:58:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E211196E5; Sat, 13 Jul 2019 10:58:50 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-18.brq.redhat.com [10.40.204.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81FB919699; Sat, 13 Jul 2019 10:58:49 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Sat, 13 Jul 2019 12:58:36 +0200 Message-Id: <072d53d3dfe31861ca2533a5abf043686e9c8b59.1563015448.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: abologna@redhat.com Subject: [libvirt] [PATCH 3/5] libvirt_nss: Drop some needless cleanup labels 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sat, 13 Jul 2019 10:59:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- tools/nss/libvirt_nss.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index e55bf144bc..3b2583669b 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -85,7 +85,6 @@ appendAddr(leaseAddress **tmpAddress, virJSONValuePtr lease, int af) { - int ret =3D -1; const char *ipAddr; virSocketAddr sa; int family; @@ -93,21 +92,20 @@ appendAddr(leaseAddress **tmpAddress, =20 if (!(ipAddr =3D virJSONValueObjectGetString(lease, "ip-address"))) { ERROR("ip-address field missing for %s", name); - goto cleanup; + return -1; } =20 DEBUG("IP address: %s", ipAddr); =20 if (virSocketAddrParse(&sa, ipAddr, AF_UNSPEC) < 0) { ERROR("Unable to parse %s", ipAddr); - goto cleanup; + return -1; } =20 family =3D VIR_SOCKET_ADDR_FAMILY(&sa); if (af !=3D AF_UNSPEC && af !=3D family) { DEBUG("Skipping address which family is %d, %d requested", family,= af); - ret =3D 0; - goto cleanup; + return 0; } =20 for (i =3D 0; i < *ntmpAddress; i++) { @@ -117,14 +115,13 @@ appendAddr(leaseAddress **tmpAddress, (void *) &sa.data.inet6.sin6_addr.s6_addr), FAMILY_ADDRESS_SIZE(family)) =3D=3D 0) { DEBUG("IP address already in the list"); - ret =3D 0; - goto cleanup; + return 0; } } =20 if (VIR_REALLOC_N_QUIET(*tmpAddress, *ntmpAddress + 1) < 0) { ERROR("Out of memory"); - goto cleanup; + return -1; } =20 (*tmpAddress)[*ntmpAddress].af =3D family; @@ -134,9 +131,7 @@ appendAddr(leaseAddress **tmpAddress, (void *) &sa.data.inet6.sin6_addr.s6_addr), FAMILY_ADDRESS_SIZE(family)); (*ntmpAddress)++; - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 @@ -153,11 +148,10 @@ findLeaseInJSON(leaseAddress **tmpAddress, size_t i; long long expirytime; time_t currtime; - int ret =3D -1; =20 if ((currtime =3D time(NULL)) =3D=3D (time_t) - 1) { ERROR("Failed to get current system time"); - goto cleanup; + return -1; } =20 for (i =3D 0; i < nleases; i++) { @@ -166,7 +160,7 @@ findLeaseInJSON(leaseAddress **tmpAddress, if (!lease) { /* This should never happen (TM) */ ERROR("Unable to get element %zu of %zu", i, nleases); - goto cleanup; + return -1; } =20 if (macs) { @@ -190,7 +184,7 @@ findLeaseInJSON(leaseAddress **tmpAddress, if (virJSONValueObjectGetNumberLong(lease, "expiry-time", &expiryt= ime) < 0) { /* A lease cannot be present without expiry-time */ ERROR("expiry-time field missing for %s", name); - goto cleanup; + return -1; } =20 /* Do not report expired lease */ @@ -203,12 +197,10 @@ findLeaseInJSON(leaseAddress **tmpAddress, *found =3D true; =20 if (appendAddr(tmpAddress, ntmpAddress, lease, af) < 0) - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list