hashmap: return more information from resize_buckets()

Return 0 if no resize was needed, 1 if successfully resized and
negative on error.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
hashmap: introduce hashmap_reserve()

With the current hashmap implementation that uses chaining, placing a
reservation can serve two purposes:
 - To optimize putting of entries if the number of entries to put is
   known. The reservation allocates buckets, so later resizing can be
   avoided.
 - To avoid having very long bucket chains after using
   hashmap_move(_one).

In an alternative hashmap implementation it will serve an additional
purpose:
 - To guarantee a subsequent hashmap_move(_one) will not fail with
   -ENOMEM (this never happens in the current implementation).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>