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

Re: [PATCH v1 3/4] hashmap: add simplified hashmap_get_from_hash() API

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 11, 2014, 22:21 UTC
Message-ID
<xmqq8unz35am.fsf@gitster.dls.corp.google.com>
In-Reply-To
<53C036F7.5070104@gmail.com>
Karsten Blees <karsten.blees@gmail.com> writes:
Show 5 quoted lines
>> In other words, why isn't hashmap_get() more like this:
>>  ...
>> with hashmap_entry_init() purely a static helper in hashmap.c?
>> 
> 1. Performance
OK.
> 2. Simplicity
>
> Hashmap clients will typically provide small, type safe wrappers around the
> hashmap API.
OK.
Show 9 quoted lines
> 3. Compound keys
>
> The key doesn't always consist of just a single word. E.g. for struct
> dir_entry, the key is [char *name, int len]. So an API like this:
>
>   void *hashmap_get(const struct hashmap *map, const void *key)
>
> won't do in the general case (unless you require clients to define their
> own key structure in addition to the entry structure...).
Yeah, I was being silly.  Thanks.
Previous: Karsten BleesNext: Karsten Blees
Message 8 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.