On 10/20/2014 08:42 PM, Lennart Poettering wrote:
> On Thu, 16.10.14 09:50, Michal Schmidt (mschm...@redhat.com) wrote:
>> +/* Fields that all hashmap/set types must have */
>> +struct HashmapBase {
>> +const struct hash_ops *hash_ops; /* hash and compare ops to use */
>> +
>> +uni
On Tue, 21.10.14 17:50, Michal Schmidt (mschm...@redhat.com) wrote:
> >> +static struct HashmapBase *__hashmap_new(const struct hash_ops *hash_ops,
> >> uint8_t type HASHMAP_DEBUG_PARAMS) {
> >> +HashmapBase *h;
> >> +
> >> +h = malloc0(all_hashmap_sizes[type]);
> >> +if
On 10/20/2014 08:42 PM, Lennart Poettering wrote:
> On Thu, 16.10.14 09:50, Michal Schmidt (mschm...@redhat.com) wrote:
>> +enum {
>> +HASHMAP_TYPE_PLAIN,
>> +HASHMAP_TYPE_LINKED,
>> +HASHMAP_TYPE_SET,
>> +__HASHMAP_TYPE_COUNT
>> +};
>
> Why is this enum anonymous?
On Thu, 16.10.14 09:50, Michal Schmidt (mschm...@redhat.com) wrote:
> +/* Distance from Initial Bucket */
> +typedef uint8_t dib_raw_t;
> +#define DIB_RAW_OVERFLOW ((dib_raw_t)0xfdU) /* indicates DIB value is
> greater than representable */
> +#define DIB_RAW_REHASH ((dib_raw_t)0xfeU) /* entry
On 10/16/2014 09:50 AM, Michal Schmidt wrote:
> --- a/src/shared/hashmap.h
> +++ b/src/shared/hashmap.h
> @@ -6,6 +6,7 @@
>This file is part of systemd.
>
>Copyright 2010 Lennart Poettering
> + Copyright 2014 Lennart Poettering
Oh, I'll fix this before pushing upstream.
Michal
___
This is a rewrite of the hashmap implementation. Its advantage is lower
memory usage.
It uses open addressing (entries are stored in an array, as opposed to
linked lists). Hash collisions are resolved with linear probing and
Robin Hood displacement policy. See the references in hashmap.c.
Some fu