This prepares for adding a new function that deals with a "struct hmap"
moving, as opposed to a "struct hmap_node".
Since there was only a single call to this in the whole tree, and its
caller didn't have any callers of its own at all, also move this function
from hmap.h to hmap.c.
This is useful in cases where one might want to know whether an hmap_node
is actually part of an hmap, without using a separate variable to indicate
it.
Usually, the hash comparison that HMAP_FOR_EACH_WITH_HASH does is an
optimization, because comparing a hash value is usually cheaper than
comparing an entire hash map key. But for simple hash map keys, it makes
sense to just compare the key directly, because it avoids doing two
comparisons when a single simple comparison suffices. This commit adds new
functions and macros to support this simple case.
When hmap_replace() replaces one hash table node by another, it must
ensure that any nodes following the old node also follow the new node,
by copying the "next" pointer from "old" to "new".