From patchwork Sun Oct 6 23:30:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Wong X-Patchwork-Id: 11176621 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1ADB718A6 for ; Sun, 6 Oct 2019 23:30:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 046E62080F for ; Sun, 6 Oct 2019 23:30:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbfJFXaw (ORCPT ); Sun, 6 Oct 2019 19:30:52 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:39118 "EHLO dcvr.yhbt.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbfJFXav (ORCPT ); Sun, 6 Oct 2019 19:30:51 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 399031F4C0; Sun, 6 Oct 2019 23:30:44 +0000 (UTC) From: Eric Wong To: Junio C Hamano Cc: git@vger.kernel.org, Derrick Stolee , Johannes Schindelin , Phillip Wood Subject: [PATCH v3 03/20] packfile: use hashmap_entry in delta_base_cache_entry Date: Sun, 6 Oct 2019 23:30:26 +0000 Message-Id: <20191006233043.3516-4-e@80x24.org> In-Reply-To: <20191006233043.3516-1-e@80x24.org> References: <20191006233043.3516-1-e@80x24.org> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This hashmap_entry_init function is intended to take a hashmap_entry struct pointer, not a hashmap struct pointer. This was not noticed because hashmap_entry_init takes a "void *" arg instead of "struct hashmap_entry *", and the hashmap struct is larger and can be cast into a hashmap_entry struct without data corruption. This has the beneficial side effect of reducing the size of a delta_base_cache_entry from 104 bytes to 72 bytes on 64-bit systems. Signed-off-by: Eric Wong Reviewed-by: Derrick Stolee --- packfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packfile.c b/packfile.c index fc43a6c52c..37fe0b73a6 100644 --- a/packfile.c +++ b/packfile.c @@ -1361,7 +1361,7 @@ struct delta_base_cache_key { }; struct delta_base_cache_entry { - struct hashmap hash; + struct hashmap_entry ent; struct delta_base_cache_key key; struct list_head lru; void *data;