[RFC] Map improvements

I will need khash in other modules soon, but I find it's API displeasing to write and read(bucket iterators are exposed, for example). This PR is to refactor the map module into a generic macro with the key type as parameter. This will also replace the 'khash set' used in api/helpers.c with a uintptr->ptr macro