do_for_each_entry_in_dir(): eliminate `offset` argument
It was never used. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Apr 16, 2017 at 08:41 UTC
5c7bba77b261f0b5979bacf3cb2516baf211d6f5
3 files changed
+10
-11
refs/files-backend.c
+2
-2
@@ -1387,7 +1387,7 @@ static int commit_packed_refs(struct files_ref_store *refs)
1387
1388
fprintf_or_die(out, "%s", PACKED_REFS_HEADER);
1389
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);
1391
1392
if (commit_lock_file(packed_ref_cache->lock)) {
1393
save_errno = errno;
@@ -1581,7 +1581,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
1581
lock_packed_refs(refs, LOCK_DIE_ON_ERROR);
1582
cbdata.packed_refs = get_packed_refs(refs);
1583
1584
- do_for_each_entry_in_dir(get_loose_refs(refs), 0,
1584
+ do_for_each_entry_in_dir(get_loose_refs(refs),
1585
pack_if_possible_fn, &cbdata);
1586
1587
if (commit_packed_refs(refs))
refs/ref-cache.c
+3
-3
@@ -307,18 +307,18 @@ static void sort_ref_dir(struct ref_dir *dir)
307
dir->sorted = dir->nr = i;
308
}
309
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,
311
each_ref_entry_fn fn, void *cb_data)
312
{
313
int i;
314
assert(dir->sorted == dir->nr);
315
- for (i = offset; i < dir->nr; i++) {
315
+ for (i = 0; i < dir->nr; i++) {
316
struct ref_entry *entry = dir->entries[i];
317
int retval;
318
if (entry->flag & REF_DIR) {
319
struct ref_dir *subdir = get_ref_dir(entry);
320
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);
322
} else {
323
retval = fn(entry, cb_data);
324
}
refs/ref-cache.h
+5
-6
@@ -258,13 +258,12 @@ struct ref_iterator *cache_ref_iterator_begin(struct ref_dir *dir);
258
typedef int each_ref_entry_fn(struct ref_entry *entry, void *cb_data);
259
260
/*
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.
265
*/
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,
267
each_ref_entry_fn fn, void *cb_data);
268
269
/*