File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,19 +33,30 @@ void oidmap_free(struct oidmap *map, int free_entries)
3333
3434void * oidmap_get (const struct oidmap * map , const struct object_id * key )
3535{
36+ if (!map -> map .cmpfn )
37+ return NULL ;
38+
3639 return hashmap_get_from_hash (& map -> map , hash (key ), key );
3740}
3841
3942void * oidmap_remove (struct oidmap * map , const struct object_id * key )
4043{
4144 struct hashmap_entry entry ;
45+
46+ if (!map -> map .cmpfn )
47+ oidmap_init (map , 0 );
48+
4249 hashmap_entry_init (& entry , hash (key ));
4350 return hashmap_remove (& map -> map , & entry , key );
4451}
4552
4653void * oidmap_put (struct oidmap * map , void * entry )
4754{
4855 struct oidmap_entry * to_put = entry ;
56+
57+ if (!map -> map .cmpfn )
58+ oidmap_init (map , 0 );
59+
4960 hashmap_entry_init (& to_put -> internal_entry , hash (& to_put -> oid ));
5061 return hashmap_put (& map -> map , to_put );
5162}
You can’t perform that action at this time.
0 commit comments