From nobody Sun Feb 8 17:04:16 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=1565952003; cv=none; d=zoho.com; s=zohoarc; b=R10Kr3dOj77aFcNg8Ka84mmsG970MEKr0ZSMf6q3EeXOwY7Hit3t0kFYD+kqP1s/a5eAWwzh6rNyHXsEV1OU8RPsuUHtsXQAxL6EyUoIsHXlAIBxVJoZErIUJxNQJRhab9BVz8uKej7mLLXB6WGSp2kesHAzJqJPA+xXfiGGPko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565952003; 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:ARC-Authentication-Results; bh=0jgmtRvI9WEBFJUNEGGbguezFGQ3ph+PiDoZ/1rkdNA=; b=Fzus5rGkd6UYYBwzCKoBR7mF43PSFgvVzX1NvhzP+QiL8Z8q+1ur4++gzGOzMQN8BMWt+EYTxqFioTVc7ecItXQRtFuYzQ/90M6XZ2FEkquQmixV+f+OuVKDZh9BG4tYKgA+K5mgy6dJlSse1u7BTfP08dNGL2BzhZpid6rWKn4= 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 1565952003009989.531037234629; Fri, 16 Aug 2019 03:40:03 -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 020ED2A09DA; Fri, 16 Aug 2019 10:40:01 +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 C57741001B17; Fri, 16 Aug 2019 10:40:00 +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 84604149FB; Fri, 16 Aug 2019 10:40:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7GAdkiN021540 for ; Fri, 16 Aug 2019 06:39:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 019F660C5D; Fri, 16 Aug 2019 10:39:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81BA39F6B for ; Fri, 16 Aug 2019 10:39:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 16 Aug 2019 12:39:27 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/14] tests: storage: Refactor cleanup in testBackingParse 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]); Fri, 16 Aug 2019 10:40:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Automatically clean the temporary buffer and get rid of the cleanup label. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virstoragetest.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index ef16b3c6e0..1c7ba466f1 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -609,28 +609,27 @@ static int testBackingParse(const void *args) { const struct testBackingParseData *data =3D args; - virBuffer buf =3D VIR_BUFFER_INITIALIZER; - int ret =3D -1; + VIR_AUTOCLEAN(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; VIR_AUTOFREE(char *) xml =3D NULL; VIR_AUTOUNREF(virStorageSourcePtr) src =3D NULL; if (!(src =3D virStorageSourceNewFromBackingAbsolute(data->backing))) { if (!data->expect) - ret =3D 0; - - goto cleanup; + return 0; + else + return -1; } if (src && !data->expect) { fprintf(stderr, "parsing of backing store string '%s' should " "have failed\n", data->backing); - goto cleanup; + return -1; } if (virDomainDiskSourceFormat(&buf, src, "source", 0, false, 0, NULL) = < 0 || !(xml =3D virBufferContentAndReset(&buf))) { fprintf(stderr, "failed to format disk source xml\n"); - goto cleanup; + return -1; } if (STRNEQ(xml, data->expect)) { @@ -638,15 +637,10 @@ testBackingParse(const void *args) "expected storage source xml:\n%s\n" "actual storage source xml:\n%s\n", data->backing, data->expect, xml); - goto cleanup; + return -1; } - ret =3D 0; - - cleanup: - virBufferFreeAndReset(&buf); - - return ret; + return 0; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list