Re: [PATCH 1/4] Add a new function, string_list_split_in_place()

2012-09-10 Thread Junio C Hamano
Michael Haggerty writes: > OK, so the bottom line would be to have two versions of the function. > One takes a (const char *) and *requires* strdup_strings to be set on > its input list: > > int string_list_split(struct string_list *list, const char *string, > int delim, int m

Re: [PATCH 1/4] Add a new function, string_list_split_in_place()

2012-09-10 Thread Michael Haggerty
On 09/10/2012 07:47 AM, Junio C Hamano wrote: > Michael Haggerty writes: > >> ... Consider something like >> >> struct string_list *split_file_into_words(FILE *f) >> { >> char buf[1024]; >> struct string_list *list = new string list; >> list->strdup_strings = 1; >

Re: [PATCH 1/4] Add a new function, string_list_split_in_place()

2012-09-09 Thread Junio C Hamano
Michael Haggerty writes: > ... Consider something like > > struct string_list *split_file_into_words(FILE *f) > { > char buf[1024]; > struct string_list *list = new string list; > list->strdup_strings = 1; > while (not EOF) { > read_line_into_b

Re: [PATCH 1/4] Add a new function, string_list_split_in_place()

2012-09-09 Thread Michael Haggerty
On 09/09/2012 11:35 AM, Junio C Hamano wrote: > Michael Haggerty writes: > >> Split a string into a string_list on a separator character. >> >> This is similar to the strbuf_split_*() functions except that it works >> with the more powerful string_list interface. If strdup_strings is >> false, i

Re: [PATCH 1/4] Add a new function, string_list_split_in_place()

2012-09-09 Thread Junio C Hamano
Michael Haggerty writes: > Split a string into a string_list on a separator character. > > This is similar to the strbuf_split_*() functions except that it works > with the more powerful string_list interface. If strdup_strings is > false, it reuses the memory from the input string (thereby need

[PATCH 1/4] Add a new function, string_list_split_in_place()

2012-09-08 Thread Michael Haggerty
Split a string into a string_list on a separator character. This is similar to the strbuf_split_*() functions except that it works with the more powerful string_list interface. If strdup_strings is false, it reuses the memory from the input string (thereby needing no string memory allocations, th