From nobody Tue May 13 18:34:09 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 1530481513505707.8547681007373; Sun, 1 Jul 2018 14:45:13 -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 2DBAF87628; Sun, 1 Jul 2018 21:45:12 +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 EA71C60BE3; Sun, 1 Jul 2018 21:45:11 +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 9969018037FE; Sun, 1 Jul 2018 21:45:11 +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 w61Lj83H009400 for ; Sun, 1 Jul 2018 17:45:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9F40F60C9A; Sun, 1 Jul 2018 21:45:08 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96E4D60C8F for ; Sun, 1 Jul 2018 21:45:05 +0000 (UTC) Received: from mail-pf0-f173.google.com (mail-pf0-f173.google.com [209.85.192.173]) (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 8D0925F72E for ; Sun, 1 Jul 2018 21:44:54 +0000 (UTC) Received: by mail-pf0-f173.google.com with SMTP id b17-v6so6536031pfi.0 for ; Sun, 01 Jul 2018 14:44:54 -0700 (PDT) Received: from centos.localdomain ([157.37.164.55]) by smtp.gmail.com with ESMTPSA id v68-v6sm15006933pfv.143.2018.07.01.14.44.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 14:44:53 -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=xKQxb9U//91Q1YnVAMBpbTLuREZpQxVGdHFspQ8iNHU=; b=Z27LHwEaaiJaIS6M37hqB174Ws2ge1PPNRsZnU4DSawv5go8n05FWKAawIXMDgRrR9 amrHc5NnoSSPkW9XNlh3rg9shhmYhSgxEHnprfpCY2Ps0UkpzuI7UrxQPEFVKBiWsTDz MjquWnwGMVTrtVWR2owNbLz7YgJip4P8GRA0XTBxM9DRu8PF2b6iIgQeka42DPkUbIwm OWhxeFP0DLrW7cb3xNwzCVe84Tzj71paDn1y6t3R/mkQZgase+XgZOv5RXFirqVJ98lt 6pC0sKDjebWOHY6CcicChHJGr9ZT9CMlcjFC02qqBbjWAEEES+36QDkvbWARP5PLbpo4 spYA== 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=xKQxb9U//91Q1YnVAMBpbTLuREZpQxVGdHFspQ8iNHU=; b=QPxWFOzdXDO8aBrmk6Pdnj6TA4yCufnZLrhnWnXc/n3Mceqlboozgmx3wX1o/d1zqH OZNmBWAhqlzHZMxjpYyzKDd2rDRdQM4jNK83xo/gIxN8HV+AWkaqu+whOyxKezBfbNxb QrCVc+hrN22Qgj1Rxp9HBKp8Ycu4/RiqbYJduFSjLqUFjHY0/O1g0sI6USu2ChlLJ3js knIRk5hG9uPWdvCs+kAHP6i2uPlcoq+qUhAR0Vbaps6In7X4NMQGC27raZzr7kl4FJZ0 sECJxPyNh0R6dRrt+aflmdt8kmTJwDQKRlt9QpFcH6rL+npzoArQQmxZEqIv88WohJiz Th0Q== X-Gm-Message-State: APt69E0XBEotpDWWOJWIofzg4KVw9AsVOCcnEVG4OMcGCh7rpTmglpoK tsibh8mtNeRIp/PL/9c5rvbkERk7 X-Google-Smtp-Source: AAOMgpecDknHfZijlnwsEOktJUMkNS68V4uwT4VGLeYNIr0P+8torKbmT+2Bz6RiLPP83QVBu4PUcg== X-Received: by 2002:a62:2119:: with SMTP id h25-v6mr10191053pfh.112.1530481493745; Sun, 01 Jul 2018 14:44:53 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 30 Jun 2018 14:30:26 +0530 Message-Id: <1530349239-22049-23-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1530349239-22049-1-git-send-email-skrtbhtngr@gmail.com> References: <1530349239-22049-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.39]); Sun, 01 Jul 2018 21:44:54 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 01 Jul 2018 21:44:54 +0000 (UTC) for IP:'209.85.192.173' DOMAIN:'mail-pf0-f173.google.com' HELO:'mail-pf0-f173.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.785 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.173 mail-pf0-f173.google.com 209.85.192.173 mail-pf0-f173.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 22/35] 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.26]); Sun, 01 Jul 2018 21:45:12 +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 --- 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