From: Jeff King <peff@peff.net>
To: Stefan Beller <sbeller@google.com>
Cc: git@jeffhostetler.com, git@vger.kernel.org, gitster@pobox.com,
jrnieder@gmail.com
Subject: Re: [PATCHv3 2/3] patch-ids.c: use hashmap correctly
Date: Wed, 5 Jul 2017 05:00:03 -0400 [thread overview]
Message-ID: <20170705090003.ervwwantjliim3az@sigill.intra.peff.net> (raw)
In-Reply-To: <20170630191407.5381-3-sbeller@google.com>
On Fri, Jun 30, 2017 at 12:14:06PM -0700, Stefan Beller wrote:
> As eluded to in the previous patch, the code in patch-ids.c is using
> the hashmaps API wrong.
>
> Luckily we do not have a bug, as all hashmap functionality that we use
> here (hashmap_get) passes through the keydata. If hashmap_get_next were
> to be used, a bug would occur as that passes NULL for the key_data.
>
> So instead use the hashmap API correctly and provide the caller required
> data in the compare function via the first argument that always gets
> passed and was setup via the hashmap_init function.
Reviewing this a bit late, but it looks good to me. And I think the
explanation above nicely covers what is going on (and why it isn't a
bug).
-Peff
PS I think you meant "alluded" in the first sentence, unless you really
were trying to escape the previous patch. :)
next prev parent reply other threads:[~2017-07-05 9:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-29 1:13 [PATCH 0/2] Introduce data field in hashmap and migrate docs to header Stefan Beller
2017-06-29 1:13 ` [PATCH 1/2] hashmap.h: compare function has access to a data field Stefan Beller
2017-06-29 18:06 ` Junio C Hamano
2017-06-29 18:11 ` Junio C Hamano
2017-06-29 18:20 ` Stefan Beller
2017-06-30 17:26 ` Junio C Hamano
2017-06-29 1:13 ` [PATCH 2/2] hashmap: migrate documentation from Documentation/technical into header Stefan Beller
2017-06-29 13:25 ` Jeff Hostetler
2017-06-29 21:18 ` Jonathan Nieder
2017-06-29 23:41 ` Stefan Beller
2017-06-29 23:53 ` [PATCHv2 0/2] Introduce data field in hashmap and migrate docs to header Stefan Beller
2017-06-29 23:53 ` [PATCHv2 1/2] hashmap.h: compare function has access to a data field Stefan Beller
2017-06-30 17:34 ` Junio C Hamano
2017-06-30 17:41 ` Stefan Beller
2017-06-30 18:47 ` Junio C Hamano
2017-06-30 18:57 ` Stefan Beller
2017-06-30 17:39 ` Junio C Hamano
2017-06-30 18:00 ` Stefan Beller
2017-06-30 18:40 ` Junio C Hamano
2017-06-29 23:53 ` [PATCHv2 2/2] hashmap: migrate documentation from Documentation/technical into header Stefan Beller
2017-06-30 19:14 ` [PATCHv3 0/3] Introduce data field in hashmap and migrate docs to header Stefan Beller
2017-06-30 19:14 ` [PATCHv3 1/3] hashmap.h: compare function has access to a data field Stefan Beller
2017-06-30 19:14 ` [PATCHv3 2/3] patch-ids.c: use hashmap correctly Stefan Beller
2017-06-30 19:50 ` Junio C Hamano
2017-07-05 9:00 ` Jeff King [this message]
2017-06-30 19:14 ` [PATCHv3 3/3] hashmap: migrate documentation from Documentation/technical into header Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170705090003.ervwwantjliim3az@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).