On Fri, Aug 21, 2020 at 06:52:28PM +0000, Elijah Newren via GitGitGadget wrote: > From: Elijah Newren <newren@xxxxxxxxx> > > Just as it is sometimes useful for string_list to duplicate and take > ownership of memory management of the strings it contains, the same is > sometimes true for strmaps as well. Add the same flag from string_list > to strmap. This is actually one of the ugliest parts of string_list, IMHO, and I'd prefer if we can avoid duplicating it. Yes, sometimes we can manage to avoid an extra copy of a string. But the resulting ownership and lifetime questions are often very error-prone. In other data structures we've moved towards just having the structure own its data (e.g., strvec does so, and things like oidmap store their own oids). I've been happy with the simplicity of it. It also works if you use a flex-array for the key storage in the strmap_entry. :) -Peff