From nobody Mon Feb 9 16:19:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1674035745; cv=none; d=zohomail.com; s=zohoarc; b=IG9uDRSbS4Out3fz6Sd/6WL7SiDbvbsYmJZbcDjggz90idbhGhy5N3Op7br0c3vDziP7mDiT/bLtT9ItWYxqjxS+PQnNJmrIMOIRiXbvKQkenzdyWxuTpezBeQym5Ul/GZoziMvIYgFSCzeLQa1gRorfsVJt6n6TZhH+CbfINcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1674035745; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/4zRIhlp3wD8TB5xvSbPznnaw1mQSoEynNQAxtEv3zI=; b=mLhvsniYA1xo0Xuf7mG8gheUHxDAAneyyuJCNfKWZyMtR1qGKMtwu7IarReycDKL8rK/VOs+xUuTatLWaQ9rAjQUvD4V6k6qWHRWLvnItsNE+AWUlEEU/Q+7M6OFJNmOE+q55hgif2Y9cprlOuCBlT9IGdbnRUkV4A5GSPNKuwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1674035745120670.3597771414182; Wed, 18 Jan 2023 01:55:45 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.480364.744759 (Exim 4.92) (envelope-from ) id 1pI5A4-0006fe-Ft; Wed, 18 Jan 2023 09:55:16 +0000 Received: by outflank-mailman (output) from mailman id 480364.744759; Wed, 18 Jan 2023 09:55:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pI5A4-0006eA-0f; Wed, 18 Jan 2023 09:55:16 +0000 Received: by outflank-mailman (input) for mailman id 480364; Wed, 18 Jan 2023 09:55:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pI56O-0001v4-24 for xen-devel@lists.xenproject.org; Wed, 18 Jan 2023 09:51:28 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id acc8bcbe-9715-11ed-91b6-6bf2151ebd3b; Wed, 18 Jan 2023 10:51:26 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A2B9920D6A; Wed, 18 Jan 2023 09:51:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7587B139D2; Wed, 18 Jan 2023 09:51:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id pZtYGx7Bx2PaQwAAMHmgww (envelope-from ); Wed, 18 Jan 2023 09:51:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: acc8bcbe-9715-11ed-91b6-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1674035486; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/4zRIhlp3wD8TB5xvSbPznnaw1mQSoEynNQAxtEv3zI=; b=lmzH1f6y07vvYLyy1pjGwj/56F7ZUrMw7O0DXdZCaLMLVUyBNRPk2nxwkCwKgdMRwehcDT e9kEyggT7/2A4o4OBi9MmOyt1zH9KrvX/socrcLJ9SRaGOaQb+vYSziABLB+9AfaCUcvQ7 TiUGHH3OcKSsDei+AFF8IGUfBCg6g0g= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD Subject: [PATCH v4 12/17] tools/xenstore: don't let hashtable_remove() return the removed value Date: Wed, 18 Jan 2023 10:50:11 +0100 Message-Id: <20230118095016.13091-13-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230118095016.13091-1-jgross@suse.com> References: <20230118095016.13091-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1674035747324100009 Content-Type: text/plain; charset="utf-8" Letting hashtable_remove() return the value of the removed element is not used anywhere in Xenstore, and it conflicts with a hashtable created specifying the HASHTABLE_FREE_VALUE flag. So just drop returning the value. This of course requires to free the value if the HASHTABLE_FREE_VALUE was specified, as otherwise it would be a memory leak. Signed-off-by: Juergen Gross Reviewed-by: Julien Grall --- V3: - new patch V4: - make return type void (Julien Grall) --- tools/xenstore/hashtable.c | 9 ++++----- tools/xenstore/hashtable.h | 3 +-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/xenstore/hashtable.c b/tools/xenstore/hashtable.c index 299549c51e..ddca1591a2 100644 --- a/tools/xenstore/hashtable.c +++ b/tools/xenstore/hashtable.c @@ -214,7 +214,7 @@ hashtable_search(struct hashtable *h, void *k) } =20 /*************************************************************************= ****/ -void * /* returns value associated with key */ +void hashtable_remove(struct hashtable *h, void *k) { /* TODO: consider compacting the table when the load factor drops enou= gh, @@ -222,7 +222,6 @@ hashtable_remove(struct hashtable *h, void *k) =20 struct entry *e; struct entry **pE; - void *v; unsigned int hashvalue, index; =20 hashvalue =3D hash(h,k); @@ -236,16 +235,16 @@ hashtable_remove(struct hashtable *h, void *k) { *pE =3D e->next; h->entrycount--; - v =3D e->v; if (h->flags & HASHTABLE_FREE_KEY) free(e->k); + if (h->flags & HASHTABLE_FREE_VALUE) + free(e->v); free(e); - return v; + return; } pE =3D &(e->next); e =3D e->next; } - return NULL; } =20 /*************************************************************************= ****/ diff --git a/tools/xenstore/hashtable.h b/tools/xenstore/hashtable.h index 6d65431f96..780ad3c8f7 100644 --- a/tools/xenstore/hashtable.h +++ b/tools/xenstore/hashtable.h @@ -68,10 +68,9 @@ hashtable_search(struct hashtable *h, void *k); * @name hashtable_remove * @param h the hashtable to remove the item from * @param k the key to search for - does not claim ownership - * @return the value associated with the key, or NULL if none found */ =20 -void * /* returns value */ +void hashtable_remove(struct hashtable *h, void *k); =20 /*************************************************************************= **** --=20 2.35.3