Skip to content

Commit 5c7bba7

Browse files
mhaggergitster
authored andcommitted
do_for_each_entry_in_dir(): eliminate offset argument
It was never used. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e3bf298 commit 5c7bba7

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

refs/files-backend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ static int commit_packed_refs(struct files_ref_store *refs)
13871387

13881388
fprintf_or_die(out, "%s", PACKED_REFS_HEADER);
13891389
do_for_each_entry_in_dir(get_packed_ref_dir(packed_ref_cache),
1390-
0, write_packed_entry_fn, out);
1390+
write_packed_entry_fn, out);
13911391

13921392
if (commit_lock_file(packed_ref_cache->lock)) {
13931393
save_errno = errno;
@@ -1581,7 +1581,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
15811581
lock_packed_refs(refs, LOCK_DIE_ON_ERROR);
15821582
cbdata.packed_refs = get_packed_refs(refs);
15831583

1584-
do_for_each_entry_in_dir(get_loose_refs(refs), 0,
1584+
do_for_each_entry_in_dir(get_loose_refs(refs),
15851585
pack_if_possible_fn, &cbdata);
15861586

15871587
if (commit_packed_refs(refs))

refs/ref-cache.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,18 +307,18 @@ static void sort_ref_dir(struct ref_dir *dir)
307307
dir->sorted = dir->nr = i;
308308
}
309309

310-
int do_for_each_entry_in_dir(struct ref_dir *dir, int offset,
310+
int do_for_each_entry_in_dir(struct ref_dir *dir,
311311
each_ref_entry_fn fn, void *cb_data)
312312
{
313313
int i;
314314
assert(dir->sorted == dir->nr);
315-
for (i = offset; i < dir->nr; i++) {
315+
for (i = 0; i < dir->nr; i++) {
316316
struct ref_entry *entry = dir->entries[i];
317317
int retval;
318318
if (entry->flag & REF_DIR) {
319319
struct ref_dir *subdir = get_ref_dir(entry);
320320
sort_ref_dir(subdir);
321-
retval = do_for_each_entry_in_dir(subdir, 0, fn, cb_data);
321+
retval = do_for_each_entry_in_dir(subdir, fn, cb_data);
322322
} else {
323323
retval = fn(entry, cb_data);
324324
}

refs/ref-cache.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,12 @@ struct ref_iterator *cache_ref_iterator_begin(struct ref_dir *dir);
258258
typedef int each_ref_entry_fn(struct ref_entry *entry, void *cb_data);
259259

260260
/*
261-
* Call fn for each reference in dir that has index in the range
262-
* offset <= index < dir->nr. Recurse into subdirectories that are in
263-
* that index range, sorting them before iterating. This function
264-
* does not sort dir itself; it should be sorted beforehand. fn is
265-
* called for all references, including broken ones.
261+
* Call `fn` for each reference in `dir`. Recurse into subdirectories,
262+
* sorting them before iterating. This function does not sort `dir`
263+
* itself; it should be sorted beforehand. `fn` is called for all
264+
* references, including broken ones.
266265
*/
267-
int do_for_each_entry_in_dir(struct ref_dir *dir, int offset,
266+
int do_for_each_entry_in_dir(struct ref_dir *dir,
268267
each_ref_entry_fn fn, void *cb_data);
269268

270269
/*

0 commit comments

Comments
 (0)