From nobody Sun Feb 8 14:11:27 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; 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 1532174861253692.2763118003705; Sat, 21 Jul 2018 05:07:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4598783F4C; Sat, 21 Jul 2018 12:07:39 +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 043BA308BDAC; Sat, 21 Jul 2018 12:07:39 +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 7139F4EE0B; Sat, 21 Jul 2018 12:07:37 +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 w6LC7ZeG016169 for ; Sat, 21 Jul 2018 08:07:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id D2FA4600C6; Sat, 21 Jul 2018 12:07:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB970600C4 for ; Sat, 21 Jul 2018 12:07:33 +0000 (UTC) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) (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 8A6743680F for ; Sat, 21 Jul 2018 12:07:27 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id v13-v6so8966417pgr.10 for ; Sat, 21 Jul 2018 05:07:27 -0700 (PDT) Received: from centos.localdomain ([42.106.1.69]) by smtp.gmail.com with ESMTPSA id s16-v6sm5861694pfm.114.2018.07.21.05.07.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:07:26 -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=ugdp2hBqqb/kzWx1GI+cr3q7dMQAD1mZvmia3cjAzHk=; b=g+sfq8iTi6TwUWoNO6mFK2b2yTQNrBm7H/vownSABir+vyVKUPXmnDBnLjhuRB179l WEp+ogOJdz0gD71E8gJGQu5QA+R9TyyFzYbANC16cPv3P8F+nRxNEltDDTOw8/ap/APi v9t1YsNQaS0KqMO2FpwTCEvTgxKUNQ/P8jaAHYE4pgf0v+G3YTtnxgzbIkO7hWhpa5xI VPE/sylWJtymvijP965Ep/KDMwKIyoBYVNuzYvvTC9IgC3A7MUPMTzIR1TMOwBVGfkOp 9BJZ1764RkQCyYr8zASIaapVeJJ6THLJsQx6EPKW4zrCe5pRqNrROnG4WxpsMvhZ86cW q+rg== 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=ugdp2hBqqb/kzWx1GI+cr3q7dMQAD1mZvmia3cjAzHk=; b=bOD/vlwabUSGeFCfY+7G/OAM4JKeT236+agB9zIqJtn7yn9LPEqvBej+nQOt8hqJLa KJLrx51eWpFtJcCDe0qbfQW85Cuhi2HGfhbHXl6hiX668DyTKCCbHALQOMG0EqOuIXad rsPGO+3kPLiosSIHeuj+UeH4He2ODjQAzyHGeAIc9nV5Ju6mvMj6w6jdObTAvGxex3Lq QAe/kivFM7lA1KXl0d8/YWK6MftdeA4MS/4CFw+wCyTSjiLS8QKqaHoDMnRvPA2J6iUn gQTIPSidKYtdfFXFnqCjIqx3aPEikMCN883fKwHUA1nsDBkYb1Qipk0IAb6WooRCNHv7 AVTw== X-Gm-Message-State: AOUpUlFnH4fTxhe5E9N7MziIliSyvltzO+HBu4x9ZeXSFj+sXwSSiob7 spDgQx4mxpNNyHmzzSBRn9hxn+tc X-Google-Smtp-Source: AAOMgpdb+omDHivM2joeVceqaKxcp9eBhZWU6XxAjO8shsrA2nRwRC/7xDxTgkdpayFF7cFbjsfYrA== X-Received: by 2002:a62:d34a:: with SMTP id q71-v6mr5829655pfg.17.1532174846822; Sat, 21 Jul 2018 05:07:26 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 21 Jul 2018 17:36:34 +0530 Message-Id: <1532174832-21644-3-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532174832-21644-1-git-send-email-skrtbhtngr@gmail.com> References: <1532174832-21644-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.30]); Sat, 21 Jul 2018 12:07:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 21 Jul 2018 12:07:27 +0000 (UTC) for IP:'209.85.215.195' DOMAIN:'mail-pg1-f195.google.com' HELO:'mail-pg1-f195.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.215.195 mail-pg1-f195.google.com 209.85.215.195 mail-pg1-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 02/40] util: error: 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 21 Jul 2018 12:07:40 +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. Also, drop the redundant viralloc.h include, since that has moved from the source module into the header. The type virError and the declaration of virFreeError is done in include/libvirt/virterror.h which is pulled in by internal.h. When a variable of type virErrorPtr is declared using VIR_AUTOPTR, the function virFreeError will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virerror.c | 1 - src/util/virerror.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virerror.c b/src/util/virerror.c index 5f26d59..4688e01 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -30,7 +30,6 @@ #include "virerror.h" #include "datatypes.h" #include "virlog.h" -#include "viralloc.h" #include "virthread.h" #include "virutil.h" #include "virstring.h" diff --git a/src/util/virerror.h b/src/util/virerror.h index 760bfa4..31577c5 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -23,6 +23,7 @@ # define __VIRT_ERROR_H_ =20 # include "internal.h" +# include "viralloc.h" =20 # define VIR_ERROR_MAX_LENGTH 1024 =20 @@ -205,4 +206,6 @@ bool virLastErrorIsSystemErrno(int errnum); void virErrorPreserveLast(virErrorPtr *saveerr); void virErrorRestore(virErrorPtr *savederr); =20 +VIR_DEFINE_AUTOPTR_FUNC(virError, virFreeError) + #endif --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list