diff options
author | Jeff King <peff@peff.net> | 2023-02-24 07:38:30 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-24 18:13:29 +0100 |
commit | 07ffb954b3421f78c5789477a540d400bbe647a2 (patch) | |
tree | adcf7d2f4b7681df30acdcecd8e92382868d830a /http-backend.c | |
parent | serve: mark unused parameters in virtual functions (diff) | |
download | git-07ffb954b3421f78c5789477a540d400bbe647a2.tar.xz git-07ffb954b3421f78c5789477a540d400bbe647a2.zip |
object-name: mark unused parameters in disambiguate callbacks
The object-name disambiguation code triggers a callback for each
possible object id we find. This is really used for two purposes:
- "hint" functions like disambiguate_commit_only report back on
whether the value is usable
- iterator functions like repo_for_each_abbrev() use it to collect
and report matching names.
Compiling with -Wunused-parameter generates several warnings, but
they're distinct for each type. The "hint" functions never look at the
void cb_data pointer; they only care whether the oid matches our hint.
The iterator functions never look at the "struct repository" parameter;
they're just reporting back the oids they see, and always return 0.
So arguably these could be two separate interfaces:
int (*hint)(struct repository *r, const struct object_id *oid);
void (*iter)(const struct object_id *oid, void *cb_data);
But doing so would complicate the disambiguation code, which now has to
accept and call the two different types. Since we can easily squelch the
compiler warnings by annotating the functions, let's just do that.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http-backend.c')
0 files changed, 0 insertions, 0 deletions