Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion patch-ids.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ static int patch_id_neq(const void *cmpfn_data,
const struct hashmap_entry *entry_or_key,
const void *keydata UNUSED)
{
/* NEEDSWORK: const correctness? */
/*
* We drop the 'const' modifier here intentionally.
*
* The hashmap API requires us to treat the entries as const.
* However, to avoid performance regression, we lazily compute
* the patch IDs inside this comparison function. This fundamentally
* requires us to mutate the 'struct patch_id'. Therefore, we use
* container_of() to cast away the constness from the hashmap_entry.
*/
struct diff_options *opt = (void *)cmpfn_data;
struct patch_id *a, *b;

Expand Down
Loading