From nobody Sun Feb 8 17:21:30 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 1532174889098909.3846204527616; Sat, 21 Jul 2018 05:08:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 720F2C057FA3; Sat, 21 Jul 2018 12:08:02 +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 3F0FB5B681; Sat, 21 Jul 2018 12:08:02 +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 ECC151841C57; Sat, 21 Jul 2018 12:08:01 +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 w6LC7pKL016236 for ; Sat, 21 Jul 2018 08:07:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5D3C55B680; Sat, 21 Jul 2018 12:07:51 +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 5658E5D6B4 for ; Sat, 21 Jul 2018 12:07:51 +0000 (UTC) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.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 2DE81C057FA1 for ; Sat, 21 Jul 2018 12:07:40 +0000 (UTC) Received: by mail-pg1-f173.google.com with SMTP id y4-v6so8959811pgp.9 for ; Sat, 21 Jul 2018 05:07:40 -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.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:07:39 -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=y79XWLHUnzzA+oPkO4cgu9EbTVS03ReX35qhgpdUprc=; b=Lpn2etqn4cEWQd51IosHL0kY8YcyQys2qH6g0NtPCMWX5i7cPQMcNt40x7+VnbA8xc ol0j/OcDKBbjm+9MLOheNR4NJGvblcucLcTofQZOkdWQahBoEWMH4aisGMKhQQsfQzUR nlGfWFZrI0LG2hKvQzFkWZS5zbU79e8IlkqMWATvHDA9++sTZOkVfPrJd0XUOPCf7fDX hxRqAXut3rD1M0aIP/FwdKCeOQOwmOEvvqWY5Dr3TDHUGvGpGRPO4NnSDtPgtvJIjaFk y2z8fY2Y+B0WQc/3Y9qQcCiEh/oEmdiGzxjSdJQNP03RbkIvaFAXbmo7gua9DCXf0lAO awdw== 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=y79XWLHUnzzA+oPkO4cgu9EbTVS03ReX35qhgpdUprc=; b=OBifeK8AqMWXROEPWiseEd1W65PUGOPgFkvV7CtqoB8qOG1OE4LeLpQSra7fUmAiao CezgUyb/Qy6mYzE7Vbf8kFGw3RlVCRrD4d2+JPXjhG6UI1ZO1ZqZeGIGdlOytaqru2UN BNlRpYcM8uvNssXelliFLBALLnsVmpb5aF4Z0FTo2n2sMfWEpYBQXnKpnsEzoHQgi77z lKmO0AMdwLzw1T4PnbjLiT2x1XnmSqHVxrLObX2CPHqssiKL5i+MxCfU+uz5YRr8a79t KD+riZOB8RboWLOZqAkPi2H0h4TTwVJ1UVJFQU0nGXkf5aKOClLFLu8sYMgR5t1uDkid M97g== X-Gm-Message-State: AOUpUlErSDqlmUeLQAYDIFGmPcbJMemDdsOncRxseIxGyGmBaKTu2sGT /V7qoWIEnk/JFSoxlF7HvXtGvSNj X-Google-Smtp-Source: AAOMgpdhPndrs8CsiE4VQgtgXzUxW661MSFNc/PTRzz9CN8ZNH1xuXoAaCG2ZZKIu9MYSN45/7362A== X-Received: by 2002:a65:5307:: with SMTP id m7-v6mr5543597pgq.431.1532174859463; Sat, 21 Jul 2018 05:07:39 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 21 Jul 2018 17:36:39 +0530 Message-Id: <1532174832-21644-8-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.32]); Sat, 21 Jul 2018 12:07:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 21 Jul 2018 12:07:40 +0000 (UTC) for IP:'209.85.215.173' DOMAIN:'mail-pg1-f173.google.com' HELO:'mail-pg1-f173.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.215.173 mail-pg1-f173.google.com 209.85.215.173 mail-pg1-f173.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 07/40] util: hash: 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 21 Jul 2018 12:08:08 +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 variables of type virHashTablePtr are declared using VIR_AUTOPTR, the function virHashFree will be run automatically on it when it goes out of scope. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virhash.c | 1 - src/util/virhash.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/util/virhash.c b/src/util/virhash.c index ecda55d..006ffd8 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -26,7 +26,6 @@ =20 #include "virerror.h" #include "virhash.h" -#include "viralloc.h" #include "virlog.h" #include "virhashcode.h" #include "virrandom.h" diff --git a/src/util/virhash.h b/src/util/virhash.h index 5b24fc0..dd789c6 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -16,6 +16,8 @@ # include # include =20 +# include "viralloc.h" + /* * The hash table. */ @@ -200,4 +202,6 @@ void *virHashSearch(const virHashTable *table, virHashS= earcher iter, /* Convenience for when VIR_FREE(value) is sufficient as a data freer. */ void virHashValueFree(void *value, const void *name); =20 +VIR_DEFINE_AUTOPTR_FUNC(virHashTable, virHashFree) + #endif /* ! __VIR_HASH_H__ */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list