On Thu, Jul 29, 2021 at 08:30:23PM -0600, Elijah Newren wrote:
quoted
What if there was a flags field? Then it could be combined with the
free_values parameter. The result is kind of verbose in two ways:
- now strset_clear(), etc, need a "flags" parameter, which they didn't
before (and is just "0" most of the time!)
- now "strmap_clear(foo, 1)" becomes "strmap_clear(foo, STRMAP_FREE_VALUES)".
That's a lot longer, though arguably it's easier to understand since
the boolean is explained.
Having gone through the exercise, I am not sure it is actually making
anything more readable (messy patch is below for reference).
Thanks for diving in. Since it's not clear if it's helping, I'll just
take your earlier suggestion to rename the "strmap_func" variable to
"strmap_clear_func" instead.
That sounds just fine with me. Thanks for considering my tangent. :)
-Peff