From nobody Sun Feb 8 20:59:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604509588; cv=none; d=zohomail.com; s=zohoarc; b=gIy401renIhnZ6UG5AGa3qliiKqCmj6PJ5yT6pcFIBLpOgqC92sw1xkPBuvZL20pMp84SgpM+OBlc+T18C8/2KIV24AsNs21/8Pkq1TKSUa7yA2CLUKX3odI59IOZw8FhZu2A0lJ0E6ZGxtt8yO9R/qfOdrpEgv/t7tYp2eFmU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604509588; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KtHRKKHU42kpNTZ8Fur+RkCFCisTWzTlw7n14A1hThE=; b=GFxWR8LcGD+BxgxTXOHQRITtn0L5V6lywcB8ZcyVfGDkui1ceHbgoqNXb3E3DqJb+ryCvmFHAD5O7nCqZEkm+2j1vOLOdJ8mxU3df9/LwlQ3Iz5JFhGsBno3WUnZyp+Umwc2JlZ1UO6cEUGYhJMulwxw0vFRjxUc9lR9iPjZAaA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604509588238375.287500833541; Wed, 4 Nov 2020 09:06:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-h6pO2yriN0G_1ADDIPISmA-1; Wed, 04 Nov 2020 12:06:24 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56FC75F9E3; Wed, 4 Nov 2020 17:06:14 +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 2B4F35C5DE; Wed, 4 Nov 2020 17:06:14 +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 EA5E8922FB; Wed, 4 Nov 2020 17:06:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A4H68m6002254 for ; Wed, 4 Nov 2020 12:06:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 030C81007515; Wed, 4 Nov 2020 17:06:08 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FBCE1007518 for ; Wed, 4 Nov 2020 17:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604509586; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KtHRKKHU42kpNTZ8Fur+RkCFCisTWzTlw7n14A1hThE=; b=Xq3/jRAoGOjax81YPXkb0HtainTeLvigUlG0fj88Dmuk+NSdgxWlCDwpYCpgb1lQsTqqbC v8uvHT+/5HedtdISfxBcnO4pDlxk+rX/qpKEwB+w9fx5tDGhkr+VS0Uuv/JtHoBHlBINDK 6VVUndo4g6WrxQXoCmWUI3Rs3c20lFU= X-MC-Unique: h6pO2yriN0G_1ADDIPISmA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 11/12] util: hash: Add deprecation notices for functions which have g_hash_table replacements Date: Wed, 4 Nov 2020 18:05:47 +0100 Message-Id: <06cdc4d46d04069658b6f340dc65c7ea2486f901.1604509429.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For functions which have reasonable replacement, let's encourage usage of g_hash_table_ alternatives. Signed-off-by: Peter Krempa --- src/util/virhash.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/util/virhash.c b/src/util/virhash.c index a7d119f8bc..5d5b6389b5 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -78,7 +78,7 @@ virHashTableStringKey(const void *vkey) * virHashNew: * @dataFree: callback to free data * - * Create a new GHashTable *. + * Create a new GHashTable * for use with string-based keys. * * Returns the newly created object. */ @@ -125,6 +125,8 @@ virHashAtomicDispose(void *obj) * * Free the hash @table and its contents. The userdata is * deallocated with function provided at creation time. + * + * Deprecated: consider using g_hash_table_unref instead */ void virHashFree(GHashTable *table) @@ -145,6 +147,10 @@ virHashFree(GHashTable *table) * Add the @userdata to the hash @table. This can later be retrieved * by using @name. Duplicate entries generate errors. * + * Deprecated: Consider using g_hash_table_insert insert. Note that + * g_hash_table_instead doesn't fail if entry exists. Also note that + * g_hash_table_insert doesn't copy the key. + * * Returns 0 the addition succeeded and -1 in case of error. */ int @@ -174,6 +180,9 @@ virHashAddEntry(GHashTable *table, const char *name, vo= id *userdata) * by using @name. Existing entry for this tuple * will be removed and freed with @f if found. * + * Deprecated: consider using g_hash_table_insert insert. Note that + * g_hash_table_insert doesn't copy the key. + * * Returns 0 the addition succeeded and -1 in case of error. */ int @@ -210,6 +219,8 @@ virHashAtomicUpdate(virHashAtomicPtr table, * * Find the userdata specified by @name * + * Deprecated: consider using g_hash_table_lookup instead + * * Returns a pointer to the userdata */ void * @@ -230,6 +241,8 @@ virHashLookup(GHashTable *table, * * Find whether entry specified by @name exists. * + * Deprecated: consider using g_hash_table_contains instead + * * Returns true if the entry exists and false otherwise */ bool @@ -251,6 +264,9 @@ virHashHasEntry(GHashTable *table, * Find the userdata specified by @name * and remove it from the hash without freeing it. * + * Deprecated: consider using g_hash_table_steal_extended once we upgrade = to + * glib 2.58 + * * Returns a pointer to the userdata */ void *virHashSteal(GHashTable *table, const char *name) @@ -290,6 +306,8 @@ virHashAtomicSteal(virHashAtomicPtr table, * * Query the number of elements installed in the hash @table. * + * Deprecated: consider using g_hash_table_size instead + * * Returns the number of elements in the hash table or * -1 in case of error */ @@ -312,6 +330,8 @@ virHashSize(GHashTable *table) * it from the hash @table. Existing userdata for this tuple will be remov= ed * and freed with @f. * + * Deprecated: consider using g_hash_table_remove + * * Returns 0 if the removal succeeded and -1 in case of error or not found. */ int @@ -353,6 +373,9 @@ virHashRemoveEntry(GHashTable *table, * If @iter fails and returns a negative value, the evaluation is stopped = and -1 * is returned. * + * Deprecated: Consider using g_hash_table_foreach as replacement for + * virHashForEach, rewrite your code if it would require virHashForEachSaf= e. + * * Returns 0 on success or -1 on failure. */ int @@ -445,6 +468,8 @@ virHashSearcherWrapFunc(gpointer key, * will be removed from the hash table & its payload passed to the * data freer callback registered at creation. * + * Deprecated: consider using g_hash_table_foreach_remove instead + * * Returns number of items removed on success, -1 on failure */ ssize_t @@ -466,6 +491,8 @@ virHashRemoveSet(GHashTable *table, * * Free the hash @table's contents. The userdata is * deallocated with the function provided at creation time. + * + * Deprecated: consider using g_hash_table_remove_all instead */ void virHashRemoveAll(GHashTable *table) @@ -488,6 +515,8 @@ virHashRemoveAll(GHashTable *table) * returns non-zero will be returned by this function. * The elements are processed in a undefined order. Caller is * responsible for freeing the @name. + * + * Deprecated: consider using g_hash_table_find instead */ void *virHashSearch(GHashTable *table, virHashSearcher iter, --=20 2.26.2