From nobody Mon Dec 15 01:36:24 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 1532639126902110.59044049289662; Thu, 26 Jul 2018 14:05:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 076A5C04BD48; Thu, 26 Jul 2018 21:05:25 +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 B9D0C16D2D; Thu, 26 Jul 2018 21:05:24 +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 5A6B518037F8; Thu, 26 Jul 2018 21:05:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL4hoB024639 for ; Thu, 26 Jul 2018 17:04:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 846655D6A8; Thu, 26 Jul 2018 21:04:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7BEC75D6A5 for ; Thu, 26 Jul 2018 21:04:40 +0000 (UTC) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 EA70E308FB90 for ; Thu, 26 Jul 2018 21:04:38 +0000 (UTC) Received: by mail-pg1-f177.google.com with SMTP id r1-v6so1881090pgp.11 for ; Thu, 26 Jul 2018 14:04:38 -0700 (PDT) Received: from centos.localdomain ([42.106.3.93]) by smtp.gmail.com with ESMTPSA id z10-v6sm3279182pfh.83.2018.07.26.14.04.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:04:37 -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=tYsj8mG5WXqPHQKKWK6xgJlrkzHH7Jh1lmwBrFM/F04=; b=gKDsCCzPi8j/+2G2vZTpC0ZSVVPQ4PmtASmNpyHWOjVRt8cKRsEp7wzVRMZ+1czXJ1 Uj9SuRnSXKqgA1c/u7RW8hF+OtYCI4Tfr47UtBJrt1JTZtwt6DfVHNCURPwA8ZCCA//e +TdBxSvm6+8d5d5ESbygpmTIm6/0BjuV3ly1Z+MrXzcWK7aw4GqicGSSiKTgMV7zU99T 11VcKZaxeem6bUQz3jWOtvqcKLRPuaVd1L4WEqNoB8+763n2mww8F7O9vH5ywFRl271e AvZKFu2A4mHADGyBrbwiA8rL++Orx4jkzRZHOwlGfYrc0zQbaPyTII/0KgZ/nThyCYoo lyng== 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=tYsj8mG5WXqPHQKKWK6xgJlrkzHH7Jh1lmwBrFM/F04=; b=RcilEE9RbhZc51w3SSF49yaHxA2kJPEQjHbBC14tITu6sT1wSCD9G4iUQRdwx34l+5 pgxCt0tTKH97QROnvQb17+kK1W3/RgZCsjDQqOLQ2Wp5uTzql/dVGyT7CyXEHbXGqQoc /5Q+C5JmoLM6kbYAY3yJ2ZS5nxF42CnjQ/k+0IIMhJs+LgOWR/FbCvKF0MD26SRPJJiC 47l6gBzdzPXxIxek7cHrQigEi9Lz9mfxT1bG2aqSPeYKXoE2cA55TrpyG6v8jkmEY4Im HugVvyx+p9uQzR4E9M1F47By7ZPkvttJdaH0SU0Gt70ehw736o5g2OmAk81xSAoaV9X1 Q3kw== X-Gm-Message-State: AOUpUlGMwwk9NUMaAB9TxY6sB1Kwr8x/5pV7/4EnL3Vs0gO2iQ3FkaQr EtVaY5IKM09y+k9AHG9W3SHhCFUw X-Google-Smtp-Source: AAOMgpeRDSGwAGyw/dZd8x/byBPI3a2Gi5nbmZIOwVGrny7gp9iP8oVMM3oNXPNR+khlFC00zc5S0A== X-Received: by 2002:a63:1844:: with SMTP id 4-v6mr3420053pgy.313.1532639078204; Thu, 26 Jul 2018 14:04:38 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:02 +0530 Message-Id: <1532447562-24010-2-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532447562-24010-1-git-send-email-skrtbhtngr@gmail.com> References: <1532447562-24010-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.43]); Thu, 26 Jul 2018 21:04:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 26 Jul 2018 21:04:39 +0000 (UTC) for IP:'209.85.215.177' DOMAIN:'mail-pg1-f177.google.com' HELO:'mail-pg1-f177.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.37 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_WEB, SPF_PASS) 209.85.215.177 mail-pg1-f177.google.com 209.85.215.177 mail-pg1-f177.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 01/41] 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Jul 2018 21:05:25 +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. 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