From: Junio C Hamano Date: Fri, 11 Jul 2014 22:21:37 GMT Subject: Re: [PATCH v1 3/4] hashmap: add simplified hashmap_get_from_hash() API Message-ID: In-Reply-To: <53C036F7.5070104@gmail.com> Karsten Blees writes: >> 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. > 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.