object-store: retire odb_load_loose_cache()
Inline odb_load_loose_cache() into its only remaining caller, odb_loose_cache(). The latter offers a nicer interface for loading the cache, as it doesn't require callers to deal with fanout directory numbers directly. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jan 7, 2019 at 18:29 UTC
8be88dbcb1322df53c41c496bf718c5564c82bfb
2 files changed
+2
-14
object-store.h
-7
@@ -47,13 +47,6 @@ void add_to_alternates_file(const char *dir);
47
*/
48
void add_to_alternates_memory(const char *dir);
49
50
-/*
51
- * Populate an odb's loose object cache for one particular subdirectory (i.e.,
52
- * the one that corresponds to the first byte of objects you're interested in,
53
- * from 0 to 255 inclusive).
54
- */
55
-void odb_load_loose_cache(struct object_directory *odb, int subdir_nr);
56
-
50
/*
51
* Populate and return the loose object cache array corresponding to the
52
* given object ID.
sha1-file.c
+2
-7
@@ -2154,12 +2154,6 @@ struct oid_array *odb_loose_cache(struct object_directory *odb,
2154
const struct object_id *oid)
2155
{
2156
int subdir_nr = oid->hash[0];
2157
- odb_load_loose_cache(odb, subdir_nr);
2158
- return &odb->loose_objects_cache[subdir_nr];
2159
-}
2160
-
2161
-void odb_load_loose_cache(struct object_directory *odb, int subdir_nr)
2162
-{
2157
struct strbuf buf = STRBUF_INIT;
2158
2159
if (subdir_nr < 0 ||
@@ -2167,7 +2161,7 @@ void odb_load_loose_cache(struct object_directory *odb, int subdir_nr)
2161
BUG("subdir_nr out of range");
2162
2163
if (odb->loose_objects_subdir_seen[subdir_nr])
2170
- return;
2164
+ return &odb->loose_objects_cache[subdir_nr];
2165
2166
strbuf_addstr(&buf, odb->path);
2167
for_each_file_in_obj_subdir(subdir_nr, &buf,
@@ -2176,6 +2170,7 @@ void odb_load_loose_cache(struct object_directory *odb, int subdir_nr)
2170
&odb->loose_objects_cache[subdir_nr]);
2171
odb->loose_objects_subdir_seen[subdir_nr] = 1;
2172
strbuf_release(&buf);
2173
+ return &odb->loose_objects_cache[subdir_nr];
2174
}
2175
2176
void odb_clear_loose_cache(struct object_directory *odb)