summaryrefslogtreecommitdiffstats
path: root/reftable/blocksource.c
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 /reftable/blocksource.c
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 'reftable/blocksource.c')
-rw-r--r--reftable/blocksource.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/reftable/blocksource.c b/reftable/blocksource.c
index eeed254ba9..abce4bb2e1 100644
--- a/reftable/blocksource.c
+++ b/reftable/blocksource.c
@@ -13,14 +13,14 @@ https://developers.google.com/open-source/licenses/bsd
#include "reftable-blocksource.h"
#include "reftable-error.h"
-static void strbuf_return_block(void *b, struct reftable_block *dest)
+static void strbuf_return_block(void *b UNUSED, struct reftable_block *dest)
{
if (dest->len)
memset(dest->data, 0xff, dest->len);
reftable_free(dest->data);
}
-static void strbuf_close(void *b)
+static void strbuf_close(void *b UNUSED)
{
}
@@ -55,7 +55,7 @@ void block_source_from_strbuf(struct reftable_block_source *bs,
bs->arg = buf;
}
-static void malloc_return_block(void *b, struct reftable_block *dest)
+static void malloc_return_block(void *b UNUSED, struct reftable_block *dest)
{
if (dest->len)
memset(dest->data, 0xff, dest->len);
@@ -85,7 +85,7 @@ static uint64_t file_size(void *b)
return ((struct file_block_source *)b)->size;
}
-static void file_return_block(void *b, struct reftable_block *dest)
+static void file_return_block(void *b UNUSED, struct reftable_block *dest UNUSED)
{
}