refs: mark unused virtual method parameters
The refs code uses various polymorphic types (e.g., loose vs packed ref_stores, abstracted iterators). Not every virtual function or callback needs all of its parameters. Let's mark the unused ones to quiet -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Aug 19, 2022 at 06:08 UTC
7718827a2d4ec90c9cbdb7ec01f68065bdb52dc2
3 files changed
+16
-14
refs/files-backend.c
+5
-5
@@ -2202,8 +2202,8 @@ static int files_reflog_iterator_advance(struct ref_iterator *ref_iterator)
2202
return ok;
2203
}
2204
2205
-static int files_reflog_iterator_peel(struct ref_iterator *ref_iterator,
2206
- struct object_id *peeled)
2205
+static int files_reflog_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
2206
+ struct object_id *UNUSED(peeled))
2207
{
2208
BUG("ref_iterator_peel() called for reflog_iterator");
2209
}
@@ -2257,7 +2257,7 @@ static struct ref_iterator *reflog_iterator_begin(struct ref_store *ref_store,
2257
static enum iterator_selection reflog_iterator_select(
2258
struct ref_iterator *iter_worktree,
2259
struct ref_iterator *iter_common,
2260
- void *cb_data)
2260
+ void *UNUSED(cb_data))
2261
{
2262
if (iter_worktree) {
2263
/*
@@ -2985,7 +2985,7 @@ cleanup:
2985
2986
static int files_transaction_abort(struct ref_store *ref_store,
2987
struct ref_transaction *transaction,
2988
- struct strbuf *err)
2988
+ struct strbuf *UNUSED(err))
2989
{
2990
struct files_ref_store *refs =
2991
files_downcast(ref_store, 0, "ref_transaction_abort");
@@ -3261,7 +3261,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
3261
return -1;
3262
}
3263
3264
-static int files_init_db(struct ref_store *ref_store, struct strbuf *err)
3264
+static int files_init_db(struct ref_store *ref_store, struct strbuf *UNUSED(err))
3265
{
3266
struct files_ref_store *refs =
3267
files_downcast(ref_store, REF_STORE_WRITE, "init_db");
refs/iterator.c
+3
-3
@@ -51,8 +51,8 @@ static int empty_ref_iterator_advance(struct ref_iterator *ref_iterator)
51
return ref_iterator_abort(ref_iterator);
52
}
53
54
-static int empty_ref_iterator_peel(struct ref_iterator *ref_iterator,
55
- struct object_id *peeled)
54
+static int empty_ref_iterator_peel(struct ref_iterator *UNUSED(ref_iterator),
55
+ struct object_id *UNUSED(peeled))
56
{
57
BUG("peel called for empty iterator");
58
}
@@ -238,7 +238,7 @@ struct ref_iterator *merge_ref_iterator_begin(
238
*/
239
static enum iterator_selection overlay_iterator_select(
240
struct ref_iterator *front, struct ref_iterator *back,
241
- void *cb_data)
241
+ void *UNUSED(cb_data))
242
{
243
int cmp;
244
refs/packed-backend.c
+8
-6
@@ -726,7 +726,7 @@ static struct snapshot *get_snapshot(struct packed_ref_store *refs)
726
}
727
728
static int packed_read_raw_ref(struct ref_store *ref_store, const char *refname,
729
- struct object_id *oid, struct strbuf *referent,
729
+ struct object_id *oid, struct strbuf *UNUSED(referent),
730
unsigned int *type, int *failure_errno)
731
{
732
struct packed_ref_store *refs =
@@ -1078,7 +1078,8 @@ int packed_refs_is_locked(struct ref_store *ref_store)
1078
static const char PACKED_REFS_HEADER[] =
1079
"# pack-refs with: peeled fully-peeled sorted \n";
1080
1081
-static int packed_init_db(struct ref_store *ref_store, struct strbuf *err)
1081
+static int packed_init_db(struct ref_store *UNUSED(ref_store),
1082
+ struct strbuf *UNUSED(err))
1083
{
1084
/* Nothing to do. */
1085
return 0;
@@ -1473,7 +1474,7 @@ failure:
1474
1475
static int packed_transaction_abort(struct ref_store *ref_store,
1476
struct ref_transaction *transaction,
1476
- struct strbuf *err)
1477
+ struct strbuf *UNUSED(err))
1478
{
1479
struct packed_ref_store *refs = packed_downcast(
1480
ref_store,
@@ -1512,7 +1513,7 @@ cleanup:
1513
return ret;
1514
}
1515
1515
-static int packed_initial_transaction_commit(struct ref_store *ref_store,
1516
+static int packed_initial_transaction_commit(struct ref_store *UNUSED(ref_store),
1517
struct ref_transaction *transaction,
1518
struct strbuf *err)
1519
{
@@ -1568,7 +1569,8 @@ static int packed_delete_refs(struct ref_store *ref_store, const char *msg,
1569
return ret;
1570
}
1571
1571
-static int packed_pack_refs(struct ref_store *ref_store, unsigned int flags)
1572
+static int packed_pack_refs(struct ref_store *UNUSED(ref_store),
1573
+ unsigned int UNUSED(flags))
1574
{
1575
/*
1576
* Packed refs are already packed. It might be that loose refs
@@ -1578,7 +1580,7 @@ static int packed_pack_refs(struct ref_store *ref_store, unsigned int flags)
1580
return 0;
1581
}
1582
1581
-static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *ref_store)
1583
+static struct ref_iterator *packed_reflog_iterator_begin(struct ref_store *UNUSED(ref_store))
1584
{
1585
return empty_ref_iterator_begin();
1586
}