]> git.ipfire.org Git - thirdparty/git.git/commit
strmap: add a strset sub-type
authorElijah Newren <newren@gmail.com>
Fri, 6 Nov 2020 00:24:54 +0000 (00:24 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Nov 2020 17:33:35 +0000 (09:33 -0800)
commit1201eb628ac753af5751258466df5f964bdc9f17
tree4ab1943c2580973114720cad98f1b0c9a5744f69
parent6abd22065ccbec054db5af85296dd1167c670eda
strmap: add a strset sub-type

Similar to adding strintmap for special-casing a string -> int mapping,
add a strset type for cases where we really are only interested in using
strmap for storing a set rather than a mapping.  In this case, we'll
always just store NULL for the value but the different struct type makes
it clearer than code comments how a variable is intended to be used.

The difference in usage also results in some differences in API: a few
things that aren't necessary or meaningful are dropped (namely, the
free_values argument to *_clear(), and the *_get() function), and
strset_add() is chosen as the API instead of strset_put().

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
strmap.c
strmap.h