summaryrefslogtreecommitdiffstats
path: root/refs
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2024-08-17 10:24:36 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-17 18:46:12 +0200
commit4695c3f3a9a4d6d9785ae9c40ed105302ce08a1e (patch)
treeb3a64779c78db26e09de0abc4fbc95827114e21c /refs
parentreftable: drop obsolete test function declarations (diff)
downloadgit-4695c3f3a9a4d6d9785ae9c40ed105302ce08a1e.tar.xz
git-4695c3f3a9a4d6d9785ae9c40ed105302ce08a1e.zip
reftable: mark unused parameters in virtual functions
The reftable code uses a lot of virtual function pointers, but many of the concrete implementations do not need all of the parameters. For the most part these are obviously fine to just mark as UNUSED (e.g., the empty_iterator functions unsurprisingly do not do anything). Here are a few cases where I dug a little deeper (but still ended up just marking them UNUSED): - the iterator exclude_patterns is best-effort and optional (though it would be nice to support in the long run as an optimization) - ignoring the ref_store in many transaction functions is unexpected, but works because the ref_transaction itself carries enough information to do what we need. - ignoring "err" for in some cases (e.g., transaction abort) is OK because we do not return any errors. It is a little odd for reftable_be_create_reflog(), though, since we do return errors there. We should perhaps be creating string error messages at this layer, but I've punted on that for now. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs')
-rw-r--r--refs/reftable-backend.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
index 7337d4422d..a2de39f2ca 100644
--- a/refs/reftable-backend.c
+++ b/refs/reftable-backend.c
@@ -614,7 +614,7 @@ done:
static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_store,
const char *prefix,
- const char **exclude_patterns,
+ const char **exclude_patterns UNUSED,
unsigned int flags)
{
struct reftable_ref_iterator *main_iter, *worktree_iter;
@@ -1123,9 +1123,9 @@ done:
return ret;
}
-static int reftable_be_transaction_abort(struct ref_store *ref_store,
+static int reftable_be_transaction_abort(struct ref_store *ref_store UNUSED,
struct ref_transaction *transaction,
- struct strbuf *err)
+ struct strbuf *err UNUSED)
{
struct reftable_transaction_data *tx_data = transaction->backend_data;
free_transaction_data(tx_data);
@@ -1315,7 +1315,7 @@ done:
return ret;
}
-static int reftable_be_transaction_finish(struct ref_store *ref_store,
+static int reftable_be_transaction_finish(struct ref_store *ref_store UNUSED,
struct ref_transaction *transaction,
struct strbuf *err)
{
@@ -1726,8 +1726,8 @@ static int reftable_reflog_iterator_advance(struct ref_iterator *ref_iterator)
return ITER_OK;
}
-static int reftable_reflog_iterator_peel(struct ref_iterator *ref_iterator,
- struct object_id *peeled)
+static int reftable_reflog_iterator_peel(struct ref_iterator *ref_iterator UNUSED,
+ struct object_id *peeled UNUSED)
{
BUG("reftable reflog iterator cannot be peeled");
return -1;
@@ -1988,7 +1988,7 @@ done:
static int reftable_be_create_reflog(struct ref_store *ref_store,
const char *refname,
- struct strbuf *errmsg)
+ struct strbuf *errmsg UNUSED)
{
struct reftable_ref_store *refs =
reftable_be_downcast(ref_store, REF_STORE_WRITE, "create_reflog");