Re: [PATCH] string-list: make compare function compatible with qsort(3)

2016-12-29 Thread René Scharfe
Am 21.12.2016 um 17:12 schrieb Jeff King: On Wed, Dec 21, 2016 at 10:36:41AM +0100, René Scharfe wrote: One shortcoming is that the comparison function is restricted to working with the string members of items; util is inaccessible to it. Another one is that the value of cmp is passed in a

Re: [PATCH] string-list: make compare function compatible with qsort(3)

2016-12-21 Thread Junio C Hamano
Junio C Hamano writes: > I do agree that non-reentrancy is an issue that is worth solving, > though. I sounded overly negative, but I do not think of any way other than this patch to solve the reentrancy issue without using qsort_s(). Between the two, my preference is still

Re: [PATCH] string-list: make compare function compatible with qsort(3)

2016-12-21 Thread Junio C Hamano
René Scharfe writes: > The cmp member of struct string_list points to a comparison function > that is used for sorting and searching of list items. It takes two > string pointers -- like strcmp(3), which is in fact the default; > cmp_items() provides a qsort(3) compatible

Re: [PATCH] string-list: make compare function compatible with qsort(3)

2016-12-21 Thread Jeff King
On Wed, Dec 21, 2016 at 10:36:41AM +0100, René Scharfe wrote: > One shortcoming is that the comparison function is restricted to working > with the string members of items; util is inaccessible to it. Another > one is that the value of cmp is passed in a global variable to > cmp_items(), making

[PATCH] string-list: make compare function compatible with qsort(3)

2016-12-21 Thread René Scharfe
The cmp member of struct string_list points to a comparison function that is used for sorting and searching of list items. It takes two string pointers -- like strcmp(3), which is in fact the default; cmp_items() provides a qsort(3) compatible interface by passing the string members of two struct