mirror of
https://github.com/git/git.git
synced 2026-01-09 17:46:37 +00:00
odb: move packfile map into struct packfile_store
The object database tracks a map of packfiles by their respective paths, which is used to figure out whether a given packfile has already been loaded. With the introduction of the `struct packfile_store` we have a better place to host this list though. Move the map accordingly. `pack_map_entry_cmp()` isn't used anywhere but in "packfile.c" anymore after this change, so we convert it to a static function, as well. Note that we also drop the `inline` hint: the function is used as a callback function exclusively, and callbacks cannot be inlined. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
3421cb56a8
commit
14aaf5c9d8
20
packfile.h
20
packfile.h
@@ -64,6 +64,12 @@ struct packfile_store {
|
||||
*/
|
||||
struct packed_git *packs;
|
||||
|
||||
/*
|
||||
* A map of packfile names to packed_git structs for tracking which
|
||||
* packs have been loaded already.
|
||||
*/
|
||||
struct hashmap map;
|
||||
|
||||
/*
|
||||
* Whether packfiles have already been populated with this store's
|
||||
* packs.
|
||||
@@ -89,20 +95,6 @@ void packfile_store_free(struct packfile_store *store);
|
||||
*/
|
||||
void packfile_store_close(struct packfile_store *store);
|
||||
|
||||
static inline int pack_map_entry_cmp(const void *cmp_data UNUSED,
|
||||
const struct hashmap_entry *entry,
|
||||
const struct hashmap_entry *entry2,
|
||||
const void *keydata)
|
||||
{
|
||||
const char *key = keydata;
|
||||
const struct packed_git *pg1, *pg2;
|
||||
|
||||
pg1 = container_of(entry, const struct packed_git, packmap_ent);
|
||||
pg2 = container_of(entry2, const struct packed_git, packmap_ent);
|
||||
|
||||
return strcmp(pg1->pack_name, key ? key : pg2->pack_name);
|
||||
}
|
||||
|
||||
struct pack_window {
|
||||
struct pack_window *next;
|
||||
unsigned char *base;
|
||||
|
||||
Reference in New Issue
Block a user