diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-11-02 10:53:20 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-11-02 10:53:21 +0300 |
commit | b50a6701532610b5ad47a4c00adadf4ad8d4eb8b (patch) | |
tree | d54da4d04704e35b1187bf76705dc4c95d431346 | |
parent | 9ae84d2e7fc9dddec2ab0330e13b4f5c4ab7d5d0 (diff) | |
parent | beaa1d952b90523a167a5d3f24e0a8ce56a4afcd (diff) |
Merge branch 'jk/function-pointer-mismatches-fix' into maint-2.42
Code clean-up to please clang-18.
* jk/function-pointer-mismatches-fix:
hashmap: use expected signatures for comparison functions
-rw-r--r-- | compat/terminal.c | 10 | ||||
-rw-r--r-- | range-diff.c | 11 |
2 files changed, 13 insertions, 8 deletions
diff --git a/compat/terminal.c b/compat/terminal.c index 83d95e8656..0afda730f2 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -479,10 +479,13 @@ struct escape_sequence_entry { }; static int sequence_entry_cmp(const void *hashmap_cmp_fn_data UNUSED, - const struct escape_sequence_entry *e1, - const struct escape_sequence_entry *e2, + const struct hashmap_entry *he1, + const struct hashmap_entry *he2, const void *keydata) { + const struct escape_sequence_entry + *e1 = container_of(he1, const struct escape_sequence_entry, entry), + *e2 = container_of(he2, const struct escape_sequence_entry, entry); return strcmp(e1->sequence, keydata ? keydata : e2->sequence); } @@ -496,8 +499,7 @@ static int is_known_escape_sequence(const char *sequence) struct strbuf buf = STRBUF_INIT; char *p, *eol; - hashmap_init(&sequences, (hashmap_cmp_fn)sequence_entry_cmp, - NULL, 0); + hashmap_init(&sequences, sequence_entry_cmp, NULL, 0); strvec_pushl(&cp.args, "infocmp", "-L", "-1", NULL); if (pipe_command(&cp, NULL, 0, &buf, 0, NULL, 0)) diff --git a/range-diff.c b/range-diff.c index 2e86063491..ca5493984a 100644 --- a/range-diff.c +++ b/range-diff.c @@ -230,16 +230,19 @@ cleanup: } static int patch_util_cmp(const void *cmp_data UNUSED, - const struct patch_util *a, - const struct patch_util *b, - const char *keydata) + const struct hashmap_entry *ha, + const struct hashmap_entry *hb, + const void *keydata) { + const struct patch_util + *a = container_of(ha, const struct patch_util, e), + *b = container_of(hb, const struct patch_util, e); return strcmp(a->diff, keydata ? keydata : b->diff); } static void find_exact_matches(struct string_list *a, struct string_list *b) { - struct hashmap map = HASHMAP_INIT((hashmap_cmp_fn)patch_util_cmp, NULL); + struct hashmap map = HASHMAP_INIT(patch_util_cmp, NULL); int i; /* First, add the patches of a to a hash map */ |