From nobody Tue May 13 11:06:52 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 1532639139668664.8568439655743; Thu, 26 Jul 2018 14:05:39 -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 DF67B300271A; Thu, 26 Jul 2018 21:05:37 +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 ABEB216D3C; Thu, 26 Jul 2018 21:05:37 +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 5FB9824F60; Thu, 26 Jul 2018 21:05:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QL4pto024680 for ; Thu, 26 Jul 2018 17:04:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6D33661D3B; Thu, 26 Jul 2018 21:04:51 +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 AEEFC61D28 for ; Thu, 26 Jul 2018 21:04:50 +0000 (UTC) Received: from mail-pl0-f68.google.com (mail-pl0-f68.google.com [209.85.160.68]) (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 E7D5B369C8 for ; Thu, 26 Jul 2018 21:04:49 +0000 (UTC) Received: by mail-pl0-f68.google.com with SMTP id b1-v6so1341192pls.5 for ; Thu, 26 Jul 2018 14:04:49 -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.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:04:48 -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=jFlPrSzvB5tamioCpddfMM42aa9vYp6BzOGb6APxGxM=; b=fG80ooFGfJ6UTERHkyUtOby32mYKLgh6Adqk3xDBxvoVb4qksxVsY3ygQJahuTH2LH wfaQXMwOSi9v72ANqWNSz3nuOoQOo+jiCMlfb8FwzNWxv8g1cvr87xfe985sikZknjw5 OsVdtthe9kKK9xluIKrdH1nWyT3bxVM3Wnp5n/Wfkw+RvAtenRsicx16WxK3kaUvI1EP 2se/KO/yjhTT/ftbVws4jQA7+sGdFHIit4Baqz7xyvrrCWNEC9vDcc+SxgB3gcY85euC 0iGyLoXA627x38emLVjDBwQ7d9hgIPfZuBbHaYJHuzQHAh5iHB86Zs0OUzFEXZYkw/b3 dZtA== 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=jFlPrSzvB5tamioCpddfMM42aa9vYp6BzOGb6APxGxM=; b=qLTeIdnAyiF2nsgeT2NV6d4lvxAGJu+4Ngc8OJuV1Wy4tKogPghJd/vfDxwYkg0vVY rrlbwpSGmJimcdcZRe20EEY6PJWovSDpn+VPWUmGrQ2wyNbgLxXba8fQWVE22MWT/CLW fVTNyiz6ssCxy0cER6dx3FxyCmh8sdfzqU7lY8Zv/A+pfYfMQpjc+gxvoWzHEhovAFWe /pc7QtP/R8eT9eIGkzS+IuO685HQp4dkT12HZInCj0AtHj4LelnhqyFcWJtSlpPDUVmy CvHCbFpxyDN1MUDsy2kPzXRIPjf53g3670SKyyVNiugJA1vUZjzo0fEpTcGQm7Eg4lyI M1MQ== X-Gm-Message-State: AOUpUlF4d0Kfw7yYv4wNyvWAjrbqXQ4bV61nzdPWWoofMgZBYy/F6+Nh bIvyW71npwyHDGdz7Vg9QjWgNETf X-Google-Smtp-Source: AAOMgpeLSgGH+iDQ57ex+0hSuR3GTjjasUrEOO0rw7WD/cLFwc6Yxxr5ZubbAcL3TJGsBbfss9az9g== X-Received: by 2002:a17:902:6b46:: with SMTP id g6-v6mr3407136plt.251.1532639089222; Thu, 26 Jul 2018 14:04:49 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:07 +0530 Message-Id: <1532447562-24010-7-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.30]); Thu, 26 Jul 2018 21:04:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Jul 2018 21:04:50 +0000 (UTC) for IP:'209.85.160.68' DOMAIN:'mail-pl0-f68.google.com' HELO:'mail-pl0-f68.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.160.68 mail-pl0-f68.google.com 209.85.160.68 mail-pl0-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 06/41] 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.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.46]); Thu, 26 Jul 2018 21:05:38 +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