Re: [PATCH 02/11] string-list.h: add string_list_{pop, last} functions

2018-09-06 Thread Stefan Beller
> > A later patch shows > > how useful this will be. > > Instead of all of the above, how about being more direct, i.e. e.g. ok. > Conceptually, this allows string_list_clear() to be implemented in > terms of this function, i.e. > > string_list_clear(struct string_list *list, int free_u

Re: [PATCH 02/11] string-list.h: add string_list_{pop, last} functions

2018-09-06 Thread Junio C Hamano
Stefan Beller writes: > A string list can be used as a stack, but should we? verb missing. "We can use a string list as ..., but should we?" is readable. "A string list can be ..., but should it be?" also is. > A later patch shows > how useful this will be. Instead of all of the above, how a

[PATCH 02/11] string-list.h: add string_list_{pop, last} functions

2018-09-04 Thread Stefan Beller
A string list can be used as a stack, but should we? A later patch shows how useful this will be. In an earlier iteration of this patch it was suggested to return the last element or NULL (if empty), to enable a pattern of while ((item = string_list_pop(&list)) work_on(item); But it tu