]> git.ipfire.org Git - thirdparty/git.git/commitdiff
object-file: inline `for_each_loose_file_in_objdir_buf()`
authorPatrick Steinhardt <ps@pks.im>
Thu, 17 Jul 2025 04:56:37 +0000 (06:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 17 Jul 2025 05:16:16 +0000 (22:16 -0700)
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>
object-file.c
object-file.h

index fc061c37bb5a474e9fa9e028c5a20f657e57db0c..5a936f171482fe844aa2e63778f0c132be13deb5 100644 (file)
@@ -1388,26 +1388,6 @@ int for_each_file_in_obj_subdir(unsigned int subdir_nr,
        return r;
 }
 
-int for_each_loose_file_in_objdir_buf(struct strbuf *path,
-                           each_loose_object_fn obj_cb,
-                           each_loose_cruft_fn cruft_cb,
-                           each_loose_subdir_fn subdir_cb,
-                           void *data)
-{
-       int r = 0;
-       int i;
-
-       for (i = 0; i < 256; i++) {
-               r = for_each_file_in_obj_subdir(i, path, the_repository->hash_algo,
-                                               obj_cb, cruft_cb,
-                                               subdir_cb, data);
-               if (r)
-                       break;
-       }
-
-       return r;
-}
-
 int for_each_loose_file_in_objdir(const char *path,
                                  each_loose_object_fn obj_cb,
                                  each_loose_cruft_fn cruft_cb,
@@ -1418,10 +1398,15 @@ int for_each_loose_file_in_objdir(const char *path,
        int r;
 
        strbuf_addstr(&buf, path);
-       r = for_each_loose_file_in_objdir_buf(&buf, obj_cb, cruft_cb,
-                                             subdir_cb, data);
-       strbuf_release(&buf);
+       for (int i = 0; i < 256; i++) {
+               r = for_each_file_in_obj_subdir(i, &buf, the_repository->hash_algo,
+                                               obj_cb, cruft_cb,
+                                               subdir_cb, data);
+               if (r)
+                       break;
+       }
 
+       strbuf_release(&buf);
        return r;
 }
 
index 622e2b2bb7dbf003bac0a3a4bfa9e9070464d119..eca323f97362dc1388d8010e3e188c062ad43f5b 100644 (file)
@@ -98,11 +98,6 @@ int for_each_loose_file_in_objdir(const char *path,
                                  each_loose_cruft_fn cruft_cb,
                                  each_loose_subdir_fn subdir_cb,
                                  void *data);
-int for_each_loose_file_in_objdir_buf(struct strbuf *path,
-                                     each_loose_object_fn obj_cb,
-                                     each_loose_cruft_fn cruft_cb,
-                                     each_loose_subdir_fn subdir_cb,
-                                     void *data);
 
 /*
  * Iterate over all accessible loose objects without respect to