Here I introduce a new strmap type, which my new merge backed, merge-ort, uses heavily. (I also made significant use of it in my changes to diffcore-rename). This strmap type was based on Peff's proposal from a couple years ago[1], but has additions that I made as I used it. I also start the series off with a quick documentation improvement to hashmap.c to differentiate between hashmap_free() and hashmap_free_entries(), since I personally had difficulty understanding them and it affects how strmap_clear()/strmap_free() are written. The biggest issue I know about currently concerns the convenience functions for a string->integer mapping. I wanted such a mapping that didn't need to allocate an extra int but instead works by just type-casting the void* pointer to an int instead. That all seems to work, but I needed a separate name for that type, and the problem is that I couldn't come up with a good one as you'll see in the last patch. Suggestions for better naming are very much welcome. As are, of course, suggestions for other API or implementation improvements. [1] https://lore.kernel.org/git/20180906191203.GA26184@xxxxxxxxxxxxxxxxxxxxx/ Elijah Newren (5): hashmap: add usage documentation explaining hashmap_free[_entries]() strmap: new utility functions strmap: add more utility functions strmap: add strdup_strings option strmap: add functions facilitating use as a string->int map Makefile | 1 + hashmap.h | 27 +++++++++++- strmap.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ strmap.h | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 strmap.c create mode 100644 strmap.h base-commit: 675a4aaf3b226c0089108221b96559e0baae5de9 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-835%2Fnewren%2Fstrmap-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-835/newren/strmap-v1 Pull-Request: https://github.com/git/git/pull/835 -- gitgitgadget