From nobody Sat May 4 20:21:19 2024 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; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1555592728; cv=none; d=zoho.com; s=zohoarc; b=I1jq8jOx75pTMUjZkBwbhH5gBCJzxY+OMNI0GOnccdtkpdv6BffYgOm/MV6/RBcm7GzaBxD2inwC4HTzevdl230bIat+Wr5FeTbEfQbS1oXvvh7lrfrnoHtEW7jB7nfRD2tJ2CF0VMTa+K1/zz/Dhz4bfs+/TbkH/YAsKwFxgek= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555592728; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=+i5ogtJ2+xP9U6DQ0jJf3rd5Qq5yIitZW5n8OOCHyq4=; b=jsX6FsuS36zp8LuoSYSZwTILlXV2jldyA78e4ckPnCcaz7QFC/8CRubKzo0Xk9pxSyNpokZlhIwc3uQ/PvBVjGq6g4eJ2XQof55tthxLP0/M+jj2OEzRIDnVWyaqAZ52zey8mFnS/+N+vWnJQawICD562fdHuqb1q2SdMUlXpLI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1555592728334675.0613339714852; Thu, 18 Apr 2019 06:05:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF107C04959B; Thu, 18 Apr 2019 13:05:17 +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 0BC8D60BF7; Thu, 18 Apr 2019 13:05:12 +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 02958181AC46; Thu, 18 Apr 2019 13:05:02 +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 x3ID50Pm031652 for ; Thu, 18 Apr 2019 09:05:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 764235C205; Thu, 18 Apr 2019 13:05:00 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id F27AA5C206 for ; Thu, 18 Apr 2019 13:04:57 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 18 Apr 2019 15:04:54 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] testQemuGetLatestCaps: Lower chances of hash collision 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 18 Apr 2019 13:05:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This function creates a list of paths to the latest capabilities and returns them in a hash table where key is an arch string and value is the path. Well, we know how many arches there are so might as well use that as initial hash size. Signed-off-by: Michal Privoznik --- tests/testutilsqemu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index bce847ce5e..2d6a84d017 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -879,7 +879,7 @@ testQemuGetLatestCaps(void) virHashTablePtr capslatest; size_t i; =20 - if (!(capslatest =3D virHashCreate(4, virHashValueFree))) + if (!(capslatest =3D virHashCreate(ARRAY_CARDINALITY(archs), virHashVa= lueFree))) goto error; =20 VIR_TEST_VERBOSE("\n"); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list