Tanay Abhra <tanay...@gmail.com> writes:
> +/* for NULL values, 'util' for each `string_list_item` is flagged as 1 */
It's a void *, so just saying that it is flagged as 1 does not say how
it's encoded. How about "... is an 'int *' pointing to the value 1".
And actually, you can save one malloc by encoding the value directly in
the util pointer itself like
#define NULL_FLAG (void *)1
item->util = NULL_FLAG;
I find this a bit ugly, but I think Git already uses this in a few
places (git grep 'void \*) *1' for examples).
Or you can use a pointer to a single static value:
static const int boolean_null_flag = 1; // Or even without = 1.
item->util = &boolean_null_flag;
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html