Skip to content

Commit aa420c4

Browse files
kbleesgitster
authored andcommitted
hashmap: improve struct hashmap member documentation
Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 039dc71 commit aa420c4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

Documentation/technical/api-hashmap.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ Data Structures
88

99
`struct hashmap`::
1010

11-
The hash table structure.
11+
The hash table structure. Members can be used as follows, but should
12+
not be modified directly:
1213
+
13-
The `size` member keeps track of the total number of entries. The `cmpfn`
14-
member is a function used to compare two entries for equality. The `table` and
15-
`tablesize` members store the hash table and its size, respectively.
14+
The `size` member keeps track of the total number of entries (0 means the
15+
hashmap is empty).
16+
+
17+
`tablesize` is the allocated size of the hash table. A non-0 value indicates
18+
that the hashmap is initialized. It may also be useful for statistical purposes
19+
(i.e. `size / tablesize` is the current load factor).
20+
+
21+
`cmpfn` stores the comparison function specified in `hashmap_init()`. In
22+
advanced scenarios, it may be useful to change this, e.g. to switch between
23+
case-sensitive and case-insensitive lookup.
1624

1725
`struct hashmap_entry`::
1826

0 commit comments

Comments
 (0)