mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
for_each_object: mark unused callback parameters
The for_each_{loose,packed}_object interface uses callback functions, but not every callback needs all of the parameters. Mark the unused ones to satisfy -Wunused-parameter. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c50dca2a18
commit
be252d3349
@ -559,7 +559,7 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)
|
||||
}
|
||||
|
||||
static int collect_loose_object(const struct object_id *oid,
|
||||
const char *path,
|
||||
const char *path UNUSED,
|
||||
void *data)
|
||||
{
|
||||
oid_array_append(data, oid);
|
||||
@ -567,8 +567,8 @@ static int collect_loose_object(const struct object_id *oid,
|
||||
}
|
||||
|
||||
static int collect_packed_object(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
struct packed_git *pack UNUSED,
|
||||
uint32_t pos UNUSED,
|
||||
void *data)
|
||||
{
|
||||
oid_array_append(data, oid);
|
||||
@ -591,7 +591,7 @@ static int batch_unordered_object(const struct object_id *oid,
|
||||
}
|
||||
|
||||
static int batch_unordered_loose(const struct object_id *oid,
|
||||
const char *path,
|
||||
const char *path UNUSED,
|
||||
void *data)
|
||||
{
|
||||
return batch_unordered_object(oid, NULL, 0, data);
|
||||
|
@ -57,7 +57,8 @@ static void loose_garbage(const char *path)
|
||||
report_garbage(PACKDIR_FILE_GARBAGE, path);
|
||||
}
|
||||
|
||||
static int count_loose(const struct object_id *oid, const char *path, void *data)
|
||||
static int count_loose(const struct object_id *oid, const char *path,
|
||||
void *data UNUSED)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
@ -72,7 +73,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int count_cruft(const char *basename, const char *path, void *data)
|
||||
static int count_cruft(const char *basename UNUSED, const char *path,
|
||||
void *data UNUSED)
|
||||
{
|
||||
loose_garbage(path);
|
||||
return 0;
|
||||
|
@ -233,17 +233,17 @@ static void mark_unreachable_referents(const struct object_id *oid)
|
||||
}
|
||||
|
||||
static int mark_loose_unreachable_referents(const struct object_id *oid,
|
||||
const char *path,
|
||||
void *data)
|
||||
const char *path UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
mark_unreachable_referents(oid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mark_packed_unreachable_referents(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
void *data)
|
||||
struct packed_git *pack UNUSED,
|
||||
uint32_t pos UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
mark_unreachable_referents(oid);
|
||||
return 0;
|
||||
@ -661,14 +661,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
|
||||
return 0; /* keep checking other objects, even if we saw an error */
|
||||
}
|
||||
|
||||
static int fsck_cruft(const char *basename, const char *path, void *data)
|
||||
static int fsck_cruft(const char *basename, const char *path,
|
||||
void *data UNUSED)
|
||||
{
|
||||
if (!starts_with(basename, "tmp_obj_"))
|
||||
fprintf_ln(stderr, _("bad sha1 file: %s"), path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fsck_subdir(unsigned int nr, const char *path, void *data)
|
||||
static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
|
||||
{
|
||||
struct for_each_loose_cb *cb_data = data;
|
||||
struct progress *progress = cb_data->progress;
|
||||
@ -803,17 +804,17 @@ static void mark_object_for_connectivity(const struct object_id *oid)
|
||||
}
|
||||
|
||||
static int mark_loose_for_connectivity(const struct object_id *oid,
|
||||
const char *path,
|
||||
void *data)
|
||||
const char *path UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
mark_object_for_connectivity(oid);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mark_packed_for_connectivity(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
void *data)
|
||||
struct packed_git *pack UNUSED,
|
||||
uint32_t pos UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
mark_object_for_connectivity(oid);
|
||||
return 0;
|
||||
|
14
builtin/gc.c
14
builtin/gc.c
@ -976,9 +976,9 @@ struct write_loose_object_data {
|
||||
|
||||
static int loose_object_auto_limit = 100;
|
||||
|
||||
static int loose_object_count(const struct object_id *oid,
|
||||
const char *path,
|
||||
void *data)
|
||||
static int loose_object_count(const struct object_id *oid UNUSED,
|
||||
const char *path UNUSED,
|
||||
void *data)
|
||||
{
|
||||
int *count = (int*)data;
|
||||
if (++(*count) >= loose_object_auto_limit)
|
||||
@ -1003,15 +1003,15 @@ static int loose_object_auto_condition(void)
|
||||
NULL, NULL, &count);
|
||||
}
|
||||
|
||||
static int bail_on_loose(const struct object_id *oid,
|
||||
const char *path,
|
||||
void *data)
|
||||
static int bail_on_loose(const struct object_id *oid UNUSED,
|
||||
const char *path UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int write_loose_object_to_stdin(const struct object_id *oid,
|
||||
const char *path,
|
||||
const char *path UNUSED,
|
||||
void *data)
|
||||
{
|
||||
struct write_loose_object_data *d = (struct write_loose_object_data *)data;
|
||||
|
@ -3260,13 +3260,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void show_commit_pack_hint(struct commit *commit, void *_data)
|
||||
static void show_commit_pack_hint(struct commit *commit UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
/* nothing to do; commits don't have a namehash */
|
||||
}
|
||||
|
||||
static void show_object_pack_hint(struct object *object, const char *name,
|
||||
void *_data)
|
||||
void *data UNUSED)
|
||||
{
|
||||
struct object_entry *oe = packlist_find(&to_pack, &object->oid);
|
||||
if (!oe)
|
||||
@ -3762,7 +3763,7 @@ static void show_edge(struct commit *commit)
|
||||
static int add_object_in_unpacked_pack(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
void *_data)
|
||||
void *data UNUSED)
|
||||
{
|
||||
if (cruft) {
|
||||
off_t offset;
|
||||
@ -3796,7 +3797,7 @@ static void add_objects_in_unpacked_packs(void)
|
||||
}
|
||||
|
||||
static int add_loose_object(const struct object_id *oid, const char *path,
|
||||
void *data)
|
||||
void *data UNUSED)
|
||||
{
|
||||
enum object_type type = oid_object_info(the_repository, oid, NULL);
|
||||
|
||||
@ -3947,13 +3948,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
|
||||
}
|
||||
|
||||
static void record_recent_object(struct object *obj,
|
||||
const char *name,
|
||||
void *data)
|
||||
const char *name UNUSED,
|
||||
void *data UNUSED)
|
||||
{
|
||||
oid_array_append(&recent_objects, &obj->oid);
|
||||
}
|
||||
|
||||
static void record_recent_commit(struct commit *commit, void *data)
|
||||
static void record_recent_commit(struct commit *commit, void *data UNUSED)
|
||||
{
|
||||
oid_array_append(&recent_objects, &commit->object.oid);
|
||||
}
|
||||
|
@ -98,7 +98,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int prune_cruft(const char *basename, const char *path, void *data)
|
||||
static int prune_cruft(const char *basename, const char *path,
|
||||
void *data UNUSED)
|
||||
{
|
||||
if (starts_with(basename, "tmp_obj_"))
|
||||
prune_tmp_file(path);
|
||||
@ -107,7 +108,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int prune_subdir(unsigned int nr, const char *path, void *data)
|
||||
static int prune_subdir(unsigned int nr UNUSED, const char *path,
|
||||
void *data UNUSED)
|
||||
{
|
||||
if (!show_only)
|
||||
rmdir(path);
|
||||
|
@ -182,8 +182,9 @@ static void prepare_pack_objects(struct child_process *cmd,
|
||||
* Write oid to the given struct child_process's stdin, starting it first if
|
||||
* necessary.
|
||||
*/
|
||||
static int write_oid(const struct object_id *oid, struct packed_git *pack,
|
||||
uint32_t pos, void *data)
|
||||
static int write_oid(const struct object_id *oid,
|
||||
struct packed_git *pack UNUSED,
|
||||
uint32_t pos UNUSED, void *data)
|
||||
{
|
||||
struct child_process *cmd = data;
|
||||
|
||||
|
@ -257,7 +257,8 @@ static inline void finish_object__ma(struct object *obj)
|
||||
}
|
||||
}
|
||||
|
||||
static int finish_object(struct object *obj, const char *name, void *cb_data)
|
||||
static int finish_object(struct object *obj, const char *name UNUSED,
|
||||
void *cb_data)
|
||||
{
|
||||
struct rev_list_info *info = cb_data;
|
||||
if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
|
||||
|
@ -43,7 +43,8 @@ int option_parse_diagnose(const struct option *opt, const char *arg, int unset)
|
||||
return error(_("invalid --%s value '%s'"), opt->long_name, arg);
|
||||
}
|
||||
|
||||
static void dir_file_stats_objects(const char *full_path, size_t full_path_len,
|
||||
static void dir_file_stats_objects(const char *full_path,
|
||||
size_t full_path_len UNUSED,
|
||||
const char *file_name, void *data)
|
||||
{
|
||||
struct strbuf *buf = data;
|
||||
|
2
midx.c
2
midx.c
@ -1607,7 +1607,7 @@ struct clear_midx_data {
|
||||
const char *ext;
|
||||
};
|
||||
|
||||
static void clear_midx_file_ext(const char *full_path, size_t full_path_len,
|
||||
static void clear_midx_file_ext(const char *full_path, size_t full_path_len UNUSED,
|
||||
const char *file_name, void *_data)
|
||||
{
|
||||
struct clear_midx_data *data = _data;
|
||||
|
@ -2644,7 +2644,8 @@ int for_each_loose_object(each_loose_object_fn cb, void *data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int append_loose_object(const struct object_id *oid, const char *path,
|
||||
static int append_loose_object(const struct object_id *oid,
|
||||
const char *path UNUSED,
|
||||
void *data)
|
||||
{
|
||||
oidtree_insert(data, oid);
|
||||
|
@ -2204,8 +2204,8 @@ int for_each_packed_object(each_packed_object_fn cb, void *data,
|
||||
}
|
||||
|
||||
static int add_promisor_object(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
struct packed_git *pack UNUSED,
|
||||
uint32_t pos UNUSED,
|
||||
void *set_)
|
||||
{
|
||||
struct oidset *set = set_;
|
||||
|
@ -154,7 +154,8 @@ static int add_recent_loose(const struct object_id *oid,
|
||||
}
|
||||
|
||||
static int add_recent_packed(const struct object_id *oid,
|
||||
struct packed_git *p, uint32_t pos,
|
||||
struct packed_git *p,
|
||||
uint32_t pos,
|
||||
void *data)
|
||||
{
|
||||
struct object *obj;
|
||||
|
@ -3440,8 +3440,8 @@ void reset_revision_walk(void)
|
||||
}
|
||||
|
||||
static int mark_uninteresting(const struct object_id *oid,
|
||||
struct packed_git *pack,
|
||||
uint32_t pos,
|
||||
struct packed_git *pack UNUSED,
|
||||
uint32_t pos UNUSED,
|
||||
void *cb)
|
||||
{
|
||||
struct rev_info *revs = cb;
|
||||
|
Loading…
Reference in New Issue
Block a user