Skip to content

Commit

Permalink
Merge branch 'jk/function-pointer-mismatches-fix' into next
Browse files Browse the repository at this point in the history
* jk/function-pointer-mismatches-fix:
  hashmap: use expected signatures for comparison functions
  fsck: use enum object_type for fsck_walk callback
  • Loading branch information
gitster committed Aug 20, 2023
2 parents 00c1cf4 + beaa1d9 commit d59a3bf
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion builtin/fsck.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static int traverse_reachable(void)
return !!result;
}

static int mark_used(struct object *obj, int type UNUSED,
static int mark_used(struct object *obj, enum object_type type UNUSED,
void *data UNUSED, struct fsck_options *options UNUSED)
{
if (!obj)
Expand Down
10 changes: 6 additions & 4 deletions compat/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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))
Expand Down
11 changes: 7 additions & 4 deletions range-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,19 @@ static int read_patches(const char *range, struct string_list *list,
}

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 */
Expand Down

0 comments on commit d59a3bf

Please sign in to comment.