object-file: inline `for_each_loose_file_in_objdir_buf()`

The function `for_each_loose_file_in_objdir_buf()` is declared in our headers, but it is not used anywhere else than in the corresponding code file itself. Drop the declaration and inline the function into its only caller. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Jul 17, 2025 at 06:56 UTC f2c40e51b235b3814475d3988782ae5dfcae8752
2 files changed +8 -28
object-file.c
+8 -23
@@ -1388,26 +1388,6 @@ int for_each_file_in_obj_subdir(unsigned int subdir_nr,
1388 return r;
1389 }
1390
1391 -int for_each_loose_file_in_objdir_buf(struct strbuf *path,
1392 - each_loose_object_fn obj_cb,
1393 - each_loose_cruft_fn cruft_cb,
1394 - each_loose_subdir_fn subdir_cb,
1395 - void *data)
1396 -{
1397 - int r = 0;
1398 - int i;
1399 -
1400 - for (i = 0; i < 256; i++) {
1401 - r = for_each_file_in_obj_subdir(i, path, the_repository->hash_algo,
1402 - obj_cb, cruft_cb,
1403 - subdir_cb, data);
1404 - if (r)
1405 - break;
1406 - }
1407 -
1408 - return r;
1409 -}
1410 -
1391 int for_each_loose_file_in_objdir(const char *path,
1392 each_loose_object_fn obj_cb,
1393 each_loose_cruft_fn cruft_cb,
@@ -1418,10 +1398,15 @@ int for_each_loose_file_in_objdir(const char *path,
1398 int r;
1399
1400 strbuf_addstr(&buf, path);
1421 - r = for_each_loose_file_in_objdir_buf(&buf, obj_cb, cruft_cb,
1422 - subdir_cb, data);
1423 - strbuf_release(&buf);
1401 + for (int i = 0; i < 256; i++) {
1402 + r = for_each_file_in_obj_subdir(i, &buf, the_repository->hash_algo,
1403 + obj_cb, cruft_cb,
1404 + subdir_cb, data);
1405 + if (r)
1406 + break;
1407 + }
1408
1409 + strbuf_release(&buf);
1410 return r;
1411 }
1412
object-file.h
-5
@@ -98,11 +98,6 @@ int for_each_loose_file_in_objdir(const char *path,
98 each_loose_cruft_fn cruft_cb,
99 each_loose_subdir_fn subdir_cb,
100 void *data);
101 -int for_each_loose_file_in_objdir_buf(struct strbuf *path,
102 - each_loose_object_fn obj_cb,
103 - each_loose_cruft_fn cruft_cb,
104 - each_loose_subdir_fn subdir_cb,
105 - void *data);
101
102 /*
103 * Iterate over all accessible loose objects without respect to