Skip to content

Commit d3dcfa0

Browse files
peffgitster
authored andcommitted
mark "pointless" data pointers in callbacks
Both the object_array_filter() and trie_find() functions use callback functions that let the caller specify which elements match. These callbacks take a void pointer in case the caller wants to pass in extra data. But in each case, the single user of these functions just passes NULL, and the callback ignores the extra pointer. We could just remove these unused parameters from the callback interface entirely. But it's good practice to provide such a pointer, as it guides future callers of the function in the right direction (rather than tempting them to access global data). Plus it's consistent with other generic callback interfaces. So let's instead annotate the unused parameters, in order to silence the compiler's -Wunused-parameter warning. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fe9e1c commit d3dcfa0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

path.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ static void init_common_trie(void)
347347
* Helper function for update_common_dir: returns 1 if the dir
348348
* prefix is common.
349349
*/
350-
static int check_common(const char *unmatched, void *value, void *baton)
350+
static int check_common(const char *unmatched, void *value,
351+
void *baton UNUSED)
351352
{
352353
struct common_dir *dir = value;
353354

revision.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4159,7 +4159,7 @@ static struct commit *get_revision_1(struct rev_info *revs)
41594159
* Return true for entries that have not yet been shown. (This is an
41604160
* object_array_each_func_t.)
41614161
*/
4162-
static int entry_unshown(struct object_array_entry *entry, void *cb_data_unused)
4162+
static int entry_unshown(struct object_array_entry *entry, void *cb_data UNUSED)
41634163
{
41644164
return !(entry->item->flags & SHOWN);
41654165
}

0 commit comments

Comments
 (0)