From nobody Mon Feb 9 19:06:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594007167; cv=none; d=zohomail.com; s=zohoarc; b=XrKtyeTXZHJ7oZsm5CVZqnbrUru444jpk64ICY2fpcr2qHpvDSSAZfe+p7EMZNyTYjvoZCdDcikMi9UZ6hh2m4yGon5lu9EhSDmqdezrQLkuyHr3JkUizfDcv0DL5rssn+6QsYDM7odX8Y6HHqRAlBPXYAUJci1ndLLlfRF7pzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594007167; 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; bh=qFG0ToKZsZg+7Te0SVX7S5NgxhjphVimAxy/uJEteT8=; b=W76QbiGgKk1H+9jmQf+jCLdIqiONAJJl5xHc72vGBdBIfyENQym2R7a3iHylEHnbQtfGuts+rFD0AI0enEXVv8rV2nWVHJdIuIBlvOtRjb32rCAkG1qAsebE+8LDIn1mzBkzMyAks9sOlcWJXX2xvJ0U1bUQCpd1JL7v/ez3Ul4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594007167032161.14253228081668; Sun, 5 Jul 2020 20:46:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-sIb4MazoM6aXZ6HJ7dJaQg-1; Sun, 05 Jul 2020 23:42:37 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EF49191184; Mon, 6 Jul 2020 03:42:30 +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 CE33060C80; Mon, 6 Jul 2020 03:42:30 +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 9DB6E180531A; Mon, 6 Jul 2020 03:42:30 +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 0663gDqo004742 for ; Sun, 5 Jul 2020 23:42:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B14D275E39; Mon, 6 Jul 2020 03:42:13 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-194.phx2.redhat.com [10.3.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id F4162275E36 for ; Mon, 6 Jul 2020 03:42:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594007165; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qFG0ToKZsZg+7Te0SVX7S5NgxhjphVimAxy/uJEteT8=; b=VfL/4TI67cN8LnWmsuRqLIybUS/SJzbpEQHdJmw+wFfj17lqesxYevSO0fJk+DG2ZYTQHS EdXr13nLeMVAYdefA6Vg51x3FwLxNGCYc6M8fLj3PGvErYdBMKqn7N3D07+gvW0agk7GaM Q+AjKxBLi4truJTV/RDjEu8DREoYzFY= X-MC-Unique: sIb4MazoM6aXZ6HJ7dJaQg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 23/32] util: eliminate unnecessary labels Date: Sun, 5 Jul 2020 23:41:18 -0400 Message-Id: <20200706034127.1117504-24-laine@redhat.com> In-Reply-To: <20200706034127.1117504-1-laine@redhat.com> References: <20200706034127.1117504-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/util/virqemu.c | 8 ++------ src/util/virsocketaddr.c | 22 +++++++--------------- src/util/virxml.c | 8 ++------ 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/src/util/virqemu.c b/src/util/virqemu.c index 52f3a2ca12..486b8e03db 100644 --- a/src/util/virqemu.c +++ b/src/util/virqemu.c @@ -361,16 +361,12 @@ char * virQEMUBuildDriveCommandlineFromJSON(virJSONValuePtr srcdef) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - char *ret =3D NULL; =20 if (virQEMUBuildCommandLineJSON(srcdef, &buf, NULL, false, virQEMUBuildCommandLineJSONArrayNumber= ed) < 0) - goto cleanup; - - ret =3D virBufferContentAndReset(&buf); + return NULL; =20 - cleanup: - return ret; + return virBufferContentAndReset(&buf); } =20 =20 diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 0fda8e101b..e0eb76ded3 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -1265,16 +1265,15 @@ virSocketAddrPTRDomain(const virSocketAddr *addr, { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; size_t i; - int ret =3D -1; =20 if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET)) { virSocketAddrIPv4 ip; =20 if (prefix =3D=3D 0 || prefix >=3D 32 || prefix % 8 !=3D 0) - goto unsupported; + return -2; =20 if (virSocketAddrGetIPv4Addr(addr, &ip) < 0) - goto cleanup; + return -1; =20 for (i =3D prefix / 8; i > 0; i--) virBufferAsprintf(&buf, "%u.", ip[i - 1]); @@ -1284,30 +1283,23 @@ virSocketAddrPTRDomain(const virSocketAddr *addr, virSocketAddrIPv6Nibbles ip; =20 if (prefix =3D=3D 0 || prefix >=3D 128 || prefix % 4 !=3D 0) - goto unsupported; + return -2; =20 if (virSocketAddrGetIPv6Nibbles(addr, &ip) < 0) - goto cleanup; + return -1; =20 for (i =3D prefix / 4; i > 0; i--) virBufferAsprintf(&buf, "%x.", ip[i - 1]); =20 virBufferAddLit(&buf, VIR_SOCKET_ADDR_IPV6_ARPA); } else { - goto unsupported; + return -2; } =20 if (!(*ptr =3D virBufferContentAndReset(&buf))) - goto cleanup; - - ret =3D 0; - - cleanup: - return ret; + return -1; =20 - unsupported: - ret =3D -2; - goto cleanup; + return 0; } =20 void diff --git a/src/util/virxml.c b/src/util/virxml.c index 56e6f67597..5558b3829f 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1271,19 +1271,15 @@ int virXMLValidatorValidate(virXMLValidatorPtr validator, xmlDocPtr doc) { - int ret =3D -1; - if (xmlRelaxNGValidateDoc(validator->rngValid, doc) !=3D 0) { virReportError(VIR_ERR_XML_INVALID_SCHEMA, _("Unable to validate doc against %s\n%s"), validator->schemafile, virBufferCurrentContent(&validator->buf)); - goto cleanup; + return -1; } =20 - ret =3D 0; - cleanup: - return ret; + return 0; } =20 =20 --=20 2.25.4