From nobody Tue Jul 1 05:39:39 2025 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153150460652299.2037214264401; Fri, 13 Jul 2018 10:56:46 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id CB0593086259; Fri, 13 Jul 2018 17:56:44 +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 8259C60BE5; Fri, 13 Jul 2018 17:56:44 +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 2138224F5B; Fri, 13 Jul 2018 17:56:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6DHu9I3008524 for ; Fri, 13 Jul 2018 13:56:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5098E2010CF5; Fri, 13 Jul 2018 17:56:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 453572010CF4 for ; Fri, 13 Jul 2018 17:56:09 +0000 (UTC) Received: from mail-pl0-f52.google.com (mail-pl0-f52.google.com [209.85.160.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2042EC057F93 for ; Fri, 13 Jul 2018 17:55:58 +0000 (UTC) Received: by mail-pl0-f52.google.com with SMTP id k1-v6so12503398plt.2 for ; Fri, 13 Jul 2018 10:55:58 -0700 (PDT) Received: from centos.localdomain ([42.106.1.21]) by smtp.gmail.com with ESMTPSA id n5-v6sm26866817pgr.24.2018.07.13.10.55.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 10:55:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=UZ1/2q7R4axLjLxkRLRryB4KWTzlXrFs+o04HcRivEc=; b=S+QB9iMwL2/sdTOudmOIiRO1sTT9ACVKfPVHiTJ9trtU5wR4Fm106/H8DaHAbSVtOf qRRUz04t3IBNmptKj+NHi77WJUgVWIUVnlLBrMvoVnXErpi8nSkvqaRGAf6ywn929f0N xb/U5jMU7UIlR+Z0MV2rvQLjcbEEvmnzYwV5uj8z6vXeWa3sBLAmt4IBCLtjOXiZvpnK pp/1GSBlAtysovxP/RhRJ2Fi1imwA3nMXO0/gpPgykXalS3Oep3EF7fPOuHz/dSNzBp2 2MKeU/gpIrwuyo6YAQUtcehfkKlmsQP+chsEBAQXZBcg9aEdZ8IwUyg0wmEdQ5pZC2UV qNYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=UZ1/2q7R4axLjLxkRLRryB4KWTzlXrFs+o04HcRivEc=; b=ezQN7F4p0FMt6CaiTQhYMh1wv7TPtUgO11BEbotX+xaq8Th8/lBOqcqpRSoIrgcpJG 6wCYOtXkFud4uIXW3+1Xv37FMKVGiqGo7o3Z5rDoibD7AD3bln9CqvoAWW7F1R0Ye40y snJmXKldsCYOU5B2fkdtb6bjclJ8Nc89k0/g30ZiwJiEXruuGGywXCtzy7b452rTcyBu QbL3bK8lvpjBeFT6fYIbRRv0We1WHfH6/r1ZVKA3uxpN6PNpBJ/7O3BqCY1t7SB3KqaZ aMOakXKFWKxaCccqEsaVtzSdxoyfHM/vAZOZ4LYMNUU4qqb/pPKKTH4eFSSJCUxBqGrr 5FJg== X-Gm-Message-State: AOUpUlHxQ6PduX6OpKSq2cI+TO3Ca9kz+KRzh6gDPh1RKGjsHYQgBvru 2bKjk7l0/yoeG7PWprz8pFE9rp5N X-Google-Smtp-Source: AAOMgpcItGPBJRgdebDvPHzifRl3d5bheSakGJA08d+LOx5DhyJwSGbVhcqAM6oPmo/xNwQDk/zBMA== X-Received: by 2002:a17:902:28e4:: with SMTP id f91-v6mr3677381plb.70.1531504557387; Fri, 13 Jul 2018 10:55:57 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 13 Jul 2018 23:24:56 +0530 Message-Id: <1531504509-7930-19-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1531504509-7930-1-git-send-email-skrtbhtngr@gmail.com> References: <1531504509-7930-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 13 Jul 2018 17:55:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 13 Jul 2018 17:55:58 +0000 (UTC) for IP:'209.85.160.52' DOMAIN:'mail-pl0-f52.google.com' HELO:'mail-pl0-f52.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.301 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.160.52 mail-pl0-f52.google.com 209.85.160.52 mail-pl0-f52.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 18/31] util: json: define cleanup function using VIR_DEFINE_AUTOPTR_FUNC 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 13 Jul 2018 17:56:45 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Using the new VIR_DEFINE_AUTOPTR_FUNC macro defined in src/util/viralloc.h, define a new wrapper around an existing cleanup function which will be called when a variable declared with VIR_AUTOPTR macro goes out of scope. When a variable of type virJSONValuePtr is declared using VIR_AUTOPTR, the function virJSONValueFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virjson.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/virjson.h b/src/util/virjson.h index e4a82bd..75f7f17 100644 --- a/src/util/virjson.h +++ b/src/util/virjson.h @@ -26,6 +26,7 @@ =20 # include "internal.h" # include "virbitmap.h" +# include "viralloc.h" =20 # include =20 @@ -156,4 +157,6 @@ char *virJSONStringReformat(const char *jsonstr, bool p= retty); =20 virJSONValuePtr virJSONValueObjectDeflatten(virJSONValuePtr json); =20 +VIR_DEFINE_AUTOPTR_FUNC(virJSONValue, virJSONValueFree) + #endif /* __VIR_JSON_H_ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list