From nobody Sun Feb 8 23:27:03 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554219802740175.66968356071584; Tue, 2 Apr 2019 08:43:22 -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 54EEEC04FFF6; Tue, 2 Apr 2019 15:43:20 +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 D57631001E6D; Tue, 2 Apr 2019 15:43:19 +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 7ECA14EA7A; Tue, 2 Apr 2019 15:43:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x32Fg6df011862 for ; Tue, 2 Apr 2019 11:42:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19D145C21A; Tue, 2 Apr 2019 15:42:06 +0000 (UTC) Received: from icr.brq.redhat.com (unknown [10.43.2.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 969AD173F4 for ; Tue, 2 Apr 2019 15:42:03 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Tue, 2 Apr 2019 17:41:43 +0200 Message-Id: <3cb6335abc0d575c3a817c613077e576b539c537.1554219669.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCHv2 04/14] virjsontest: use VIR_AUTOPTR for virJSONValues 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-Type: text/plain; charset="utf-8" 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.31]); Tue, 02 Apr 2019 15:43:20 +0000 (UTC) Remove all explicit usage of virJSONValueFree. Signed-off-by: J=C3=A1n Tomko --- tests/virjsontest.c | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/tests/virjsontest.c b/tests/virjsontest.c index 51777ba770..bf2bb85c6c 100644 --- a/tests/virjsontest.c +++ b/tests/virjsontest.c @@ -20,7 +20,7 @@ static int testJSONFromString(const void *data) { const struct testInfo *info =3D data; - virJSONValuePtr json; + VIR_AUTOPTR(virJSONValue) json =3D NULL; const char *expectstr =3D info->expect ? info->expect : info->doc; char *formatted =3D NULL; int ret =3D -1; @@ -59,7 +59,6 @@ testJSONFromString(const void *data) =20 cleanup: VIR_FREE(formatted); - virJSONValueFree(json); return ret; } =20 @@ -68,8 +67,8 @@ static int testJSONAddRemove(const void *data) { const struct testInfo *info =3D data; - virJSONValuePtr json =3D NULL; - virJSONValuePtr name =3D NULL; + VIR_AUTOPTR(virJSONValue) json =3D NULL; + VIR_AUTOPTR(virJSONValue) name =3D NULL; char *infile =3D NULL; char *indata =3D NULL; char *outfile =3D NULL; @@ -135,8 +134,6 @@ testJSONAddRemove(const void *data) ret =3D 0; =20 cleanup: - virJSONValueFree(json); - virJSONValueFree(name); VIR_FREE(infile); VIR_FREE(indata); VIR_FREE(outfile); @@ -149,7 +146,7 @@ static int testJSONLookup(const void *data) { const struct testInfo *info =3D data; - virJSONValuePtr json; + VIR_AUTOPTR(virJSONValue) json =3D NULL; virJSONValuePtr value =3D NULL; char *result =3D NULL; int rc; @@ -247,7 +244,6 @@ testJSONLookup(const void *data) ret =3D 0; =20 cleanup: - virJSONValueFree(json); VIR_FREE(result); return ret; } @@ -257,8 +253,8 @@ static int testJSONCopy(const void *data) { const struct testInfo *info =3D data; - virJSONValuePtr json =3D NULL; - virJSONValuePtr jsonCopy =3D NULL; + VIR_AUTOPTR(virJSONValue) json =3D NULL; + VIR_AUTOPTR(virJSONValue) jsonCopy =3D NULL; char *result =3D NULL; char *resultCopy =3D NULL; int ret =3D -1; @@ -318,8 +314,6 @@ testJSONCopy(const void *data) cleanup: VIR_FREE(result); VIR_FREE(resultCopy); - virJSONValueFree(json); - virJSONValueFree(jsonCopy); return ret; } =20 @@ -328,8 +322,8 @@ static int testJSONDeflatten(const void *data) { const struct testInfo *info =3D data; - virJSONValuePtr injson =3D NULL; - virJSONValuePtr deflattened =3D NULL; + VIR_AUTOPTR(virJSONValue) injson =3D NULL; + VIR_AUTOPTR(virJSONValue) deflattened =3D NULL; char *infile =3D NULL; char *indata =3D NULL; char *outfile =3D NULL; @@ -369,8 +363,6 @@ testJSONDeflatten(const void *data) ret =3D 0; =20 cleanup: - virJSONValueFree(injson); - virJSONValueFree(deflattened); VIR_FREE(infile); VIR_FREE(indata); VIR_FREE(outfile); @@ -383,9 +375,9 @@ testJSONDeflatten(const void *data) static int testJSONEscapeObj(const void *data ATTRIBUTE_UNUSED) { - virJSONValuePtr json =3D NULL; - virJSONValuePtr nestjson =3D NULL; - virJSONValuePtr parsejson =3D NULL; + VIR_AUTOPTR(virJSONValue) json =3D NULL; + VIR_AUTOPTR(virJSONValue) nestjson =3D NULL; + VIR_AUTOPTR(virJSONValue) parsejson =3D NULL; char *neststr =3D NULL; char *result =3D NULL; const char *parsednestedstr; @@ -434,9 +426,6 @@ testJSONEscapeObj(const void *data ATTRIBUTE_UNUSED) cleanup: VIR_FREE(neststr); VIR_FREE(result); - virJSONValueFree(json); - virJSONValueFree(nestjson); - virJSONValueFree(parsejson); return ret; } =20 @@ -444,10 +433,10 @@ testJSONEscapeObj(const void *data ATTRIBUTE_UNUSED) static int testJSONObjectFormatSteal(const void *opaque ATTRIBUTE_UNUSED) { - virJSONValuePtr a1 =3D NULL; - virJSONValuePtr a2 =3D NULL; - virJSONValuePtr t1 =3D NULL; - virJSONValuePtr t2 =3D NULL; + VIR_AUTOPTR(virJSONValue) a1 =3D NULL; + VIR_AUTOPTR(virJSONValue) a2 =3D NULL; + VIR_AUTOPTR(virJSONValue) t1 =3D NULL; + VIR_AUTOPTR(virJSONValue) t2 =3D NULL; int ret =3D -1; =20 if (!(a1 =3D virJSONValueNewString("test")) || @@ -478,10 +467,6 @@ testJSONObjectFormatSteal(const void *opaque ATTRIBUTE= _UNUSED) ret =3D 0; =20 cleanup: - virJSONValueFree(a1); - virJSONValueFree(a2); - virJSONValueFree(t1); - virJSONValueFree(t2); return ret; } =20 --=20 2.19.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list