hashmap: improve struct hashmap member documentation
Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Karsten Blees committed
Jul 3, 2014 at 00:21 UTC
aa420c48eaea5c89946b8753363d09955300133f
1 file changed
+12
-4
Documentation/technical/api-hashmap.txt
+12
-4
@@ -8,11 +8,19 @@ Data Structures
8
9
`struct hashmap`::
10
11
- The hash table structure.
11
+ The hash table structure. Members can be used as follows, but should
12
+ not be modified directly:
13
+
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.
24
25
`struct hashmap_entry`::
26