hashmap: size hashmap bucket array dynamically

Backport some hashmap changes from systemd to ensure hashmap
dynamically allocates memory and optimizes lookup times.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>