git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v1 2/4] hashmap: improve struct hashmap member documentation

From
Karsten Blees <karsten.blees@gmail.com>
Date
Jul 2, 2014, 22:21 UTC
Message-ID
<53B485E1.1070701@gmail.com>
In-Reply-To
<53B48540.5070600@gmail.com>
Signed-off-by: Karsten Blees <blees@dcon.de>
---
 Documentation/technical/api-hashmap.txt | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/Documentation/technical/api-hashmap.txt b/Documentation/technical/api-hashmap.txt
index 4689968..dc21a7c 100644
--- a/Documentation/technical/api-hashmap.txt
+++ b/Documentation/technical/api-hashmap.txt
@@ -8,11 +8,19 @@ Data Structures
 
 `struct hashmap`::
 
-	The hash table structure.
+	The hash table structure. Members can be used as follows, but should
+	not be modified directly:
 +
-The `size` member keeps track of the total number of entries. The `cmpfn`
-member is a function used to compare two entries for equality. The `table` and
-`tablesize` members store the hash table and its size, respectively.
+The `size` member keeps track of the total number of entries (0 means the
+hashmap is empty).
++
+`tablesize` is the allocated size of the hash table. A non-0 value indicates
+that the hashmap is initialized. It may also be useful for statistical purposes
+(i.e. `size / tablesize` is the current load factor).
++
+`cmpfn` stores the comparison function specified in `hashmap_init()`. In
+advanced scenarios, it may be useful to change this, e.g. to switch between
+case-sensitive and case-insensitive lookup.
 
 `struct hashmap_entry`::
 
-- 
1.9.4.msysgit.0.dirty
Previous: Junio C HamanoNext: Karsten Blees
Message 4 of 12 in “hashmap improvements”
  1. 0/4 hashmap improvementsKarsten Blees, Jul 2, 2014
  2. 1/4 hashmap: factor out getting an int hash code from a, SHA1Karsten Blees, Jul 2, 2014
  3. Junio C HamanoJul 7, 2014
  4. 2/4 hashmap: improve struct hashmap member documentationKarsten Blees, Jul 2, 2014
  5. 3/4 hashmap: add simplified hashmap_get_from_hash() APIKarsten Blees, Jul 2, 2014
  6. Junio C HamanoJul 7, 2014
  7. Karsten BleesJul 11, 2014
  8. Junio C HamanoJul 11, 2014
  9. 4/4 hashmap: add string interning APIKarsten Blees, Jul 2, 2014
  10. Matthieu MoyJul 3, 2014
  11. Junio C HamanoJul 7, 2014
  12. Matthieu MoyJul 3, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.