Skip to content

Commit 4b992f0

Browse files
peffgitster
authored andcommitted
ll-merge: mark unused parameters in callbacks
We have a generic ll_merge_fn, but not every implementation needs every parameter. In particular, neither binary nor ext merges care about names (since they do not generate conflict markers), and most do not need to look at the ll_merge_driver itself. Ironically, neither ll_xdl_merge() nor ll_union_merge() needs to have their driver parameter annotated (even though both are named drv_unused!). This is because they may fall back to calling ll_binary_merge() directly. And even though that function won't look at it, we still pass it along, and hence it is "used" in the caller. We could get away with passing NULL, but that's likely more confusing and brittle than just passing along our own driver. And we have to keep the driver parameter in all callbacks, since ll_ext_merge() uses it. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0ada4b9 commit 4b992f0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ll-merge.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ void reset_merge_attributes(void)
4949
/*
5050
* Built-in low-levels
5151
*/
52-
static enum ll_merge_result ll_binary_merge(const struct ll_merge_driver *drv_unused,
52+
static enum ll_merge_result ll_binary_merge(const struct ll_merge_driver *drv UNUSED,
5353
mmbuffer_t *result,
54-
const char *path,
55-
mmfile_t *orig, const char *orig_name,
56-
mmfile_t *src1, const char *name1,
57-
mmfile_t *src2, const char *name2,
54+
const char *path UNUSED,
55+
mmfile_t *orig, const char *orig_name UNUSED,
56+
mmfile_t *src1, const char *name1 UNUSED,
57+
mmfile_t *src2, const char *name2 UNUSED,
5858
const struct ll_merge_options *opts,
59-
int marker_size)
59+
int marker_size UNUSED)
6060
{
6161
enum ll_merge_result ret;
6262
mmfile_t *stolen;
@@ -183,9 +183,9 @@ static void create_temp(mmfile_t *src, char *path, size_t len)
183183
static enum ll_merge_result ll_ext_merge(const struct ll_merge_driver *fn,
184184
mmbuffer_t *result,
185185
const char *path,
186-
mmfile_t *orig, const char *orig_name,
187-
mmfile_t *src1, const char *name1,
188-
mmfile_t *src2, const char *name2,
186+
mmfile_t *orig, const char *orig_name UNUSED,
187+
mmfile_t *src1, const char *name1 UNUSED,
188+
mmfile_t *src2, const char *name2 UNUSED,
189189
const struct ll_merge_options *opts,
190190
int marker_size)
191191
{

0 commit comments

Comments
 (0)