File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -33,19 +33,30 @@ void oidmap_free(struct oidmap *map, int free_entries)
33
33
34
34
void * oidmap_get (const struct oidmap * map , const struct object_id * key )
35
35
{
36
+ if (!map -> map .cmpfn )
37
+ return NULL ;
38
+
36
39
return hashmap_get_from_hash (& map -> map , hash (key ), key );
37
40
}
38
41
39
42
void * oidmap_remove (struct oidmap * map , const struct object_id * key )
40
43
{
41
44
struct hashmap_entry entry ;
45
+
46
+ if (!map -> map .cmpfn )
47
+ oidmap_init (map , 0 );
48
+
42
49
hashmap_entry_init (& entry , hash (key ));
43
50
return hashmap_remove (& map -> map , & entry , key );
44
51
}
45
52
46
53
void * oidmap_put (struct oidmap * map , void * entry )
47
54
{
48
55
struct oidmap_entry * to_put = entry ;
56
+
57
+ if (!map -> map .cmpfn )
58
+ oidmap_init (map , 0 );
59
+
49
60
hashmap_entry_init (& to_put -> internal_entry , hash (& to_put -> oid ));
50
61
return hashmap_put (& map -> map , to_put );
51
62
}
You can’t perform that action at this time.
0 commit comments