From nobody Sun Feb 8 22:07:45 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=1603359380; cv=none; d=zohomail.com; s=zohoarc; b=L79N1m7EM8r3wuZL4ykKo0q8wRPk7zoawtsUlAg9uTdESf7zR8pJ81JCD3IT74IDCuqKBQClaPv3g6MA6R3afgPIwLluZdjyERxtT0mnU8EPhRhSKzhW5EcTMV0Lcier5mKIBmRcYAsgKTjFUczQKcdEi0JyteRHnQ7vAcDk1ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603359380; 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=satDynnV4MFfTzRrU7dMHIRmzkRbARRbLyH4l13NNDA=; b=fabtbQLNB+jz48CXiS1CxEiSwQnO7YZTu4toVhGJYxkdXPOvq1tZsWXehO+mn2ofwhHfB4OLU5Tj0XZ+DMDdwkFSXMyih4XxCw2YKR0T/wBsQtepXroeXB11oD0pt/x1uCPu9a+cJqLErdQYXy/RkNeopwjdyc2xeuJwMNsdMl0= 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 1603359380146704.4383770590184; Thu, 22 Oct 2020 02:36:20 -0700 (PDT) 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-504-hiUMu1mMMZiDCYZMY1V4hQ-1; Thu, 22 Oct 2020 05:36:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF303188C129; Thu, 22 Oct 2020 09:36:10 +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 BE37E5B4C1; Thu, 22 Oct 2020 09:36:10 +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 84496922F9; Thu, 22 Oct 2020 09:36:10 +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 09M9ZPHa024566 for ; Thu, 22 Oct 2020 05:35:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 306295B4C0; Thu, 22 Oct 2020 09:35:25 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 876AC5B4A8 for ; Thu, 22 Oct 2020 09:35:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603359379; 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=satDynnV4MFfTzRrU7dMHIRmzkRbARRbLyH4l13NNDA=; b=B4bFO91tZzT37jpETHf1nl1XHNPq4HJEkbOOnuk/PhtRYLD96g3iq7JZSV6DE7cRj12ie9 RFTwXpAPMDD0UkmigL8Bdc1pFQY0jZ6Ce5QKXCIj5cftdFAhApJLz+NgjQLcAMIzpX0x3f mVkcVesJLMtOtR12tQUNn4O4L6t1rlI= X-MC-Unique: hiUMu1mMMZiDCYZMY1V4hQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/15] util: hash: Remove virHashCreateFull Date: Thu, 22 Oct 2020 11:35:03 +0200 Message-Id: <6fa73ba021e5b0452a7223c8c3a841b3eced8769.1603358617.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 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" The only place we call it is in virHashNew. Move the code to virHashNew and remove virHashCreateFull. Code wishing to use non-strings as hash table keys will be better off using glib's GHashTable directly. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/util/virhash.c | 53 +++++++++------------------------------------- src/util/virhash.h | 7 ------ 2 files changed, 10 insertions(+), 50 deletions(-) diff --git a/src/util/virhash.c b/src/util/virhash.c index c781e1d5a5..8d56b4bb85 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -118,43 +118,31 @@ virHashComputeKey(const virHashTable *table, const vo= id *name) return value % table->size; } + /** - * virHashCreateFull: - * @size: the size of the hash table + * virHashNew: * @dataFree: callback to free data - * @keyCode: callback to compute hash code - * @keyEqual: callback to compare hash keys - * @keyCopy: callback to copy hash keys - * @keyFree: callback to free keys * * Create a new virHashTablePtr. * * Returns the newly created object. */ -virHashTablePtr virHashCreateFull(ssize_t size, - virHashDataFree dataFree, - virHashKeyCode keyCode, - virHashKeyEqual keyEqual, - virHashKeyCopy keyCopy, - virHashKeyPrintHuman keyPrint, - virHashKeyFree keyFree) +virHashTablePtr +virHashNew(virHashDataFree dataFree) { virHashTablePtr table =3D NULL; - if (size <=3D 0) - size =3D 256; - table =3D g_new0(virHashTable, 1); table->seed =3D virRandomBits(32); - table->size =3D size; + table->size =3D 32; table->nbElems =3D 0; table->dataFree =3D dataFree; - table->keyCode =3D keyCode; - table->keyEqual =3D keyEqual; - table->keyCopy =3D keyCopy; - table->keyPrint =3D keyPrint; - table->keyFree =3D keyFree; + table->keyCode =3D virHashStrCode; + table->keyEqual =3D virHashStrEqual; + table->keyCopy =3D virHashStrCopy; + table->keyPrint =3D virHashStrPrintHuman; + table->keyFree =3D virHashStrFree; table->table =3D g_new0(virHashEntryPtr, table->size); @@ -162,27 +150,6 @@ virHashTablePtr virHashCreateFull(ssize_t size, } -/** - * virHashNew: - * @dataFree: callback to free data - * - * Create a new virHashTablePtr. - * - * Returns the newly created object. - */ -virHashTablePtr -virHashNew(virHashDataFree dataFree) -{ - return virHashCreateFull(32, - dataFree, - virHashStrCode, - virHashStrEqual, - virHashStrCopy, - virHashStrPrintHuman, - virHashStrFree); -} - - virHashAtomicPtr virHashAtomicNew(virHashDataFree dataFree) { diff --git a/src/util/virhash.h b/src/util/virhash.h index 2d221dce25..a9b022f362 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -113,13 +113,6 @@ typedef void (*virHashKeyFree)(void *name); */ virHashTablePtr virHashNew(virHashDataFree dataFree); virHashAtomicPtr virHashAtomicNew(virHashDataFree dataFree); -virHashTablePtr virHashCreateFull(ssize_t size, - virHashDataFree dataFree, - virHashKeyCode keyCode, - virHashKeyEqual keyEqual, - virHashKeyCopy keyCopy, - virHashKeyPrintHuman keyPrint, - virHashKeyFree keyFree); void virHashFree(virHashTablePtr table); ssize_t virHashSize(const virHashTable *table); --=20 2.26.2