From: Alex Riesen Date: Mon, 28 Jun 2010 08:29:49 GMT Subject: Re: [PATCH] string-list.h: Add STRING_LIST_INIT macro and make use of it. Message-ID: In-Reply-To: <7vbpawifwa.fsf@alter.siamese.dyndns.org> On Sun, Jun 27, 2010 at 18:44, Junio C Hamano wrote: > I think you need the attached on top to be more complete. > > But I wonder if this is worth it (not this "more complete", but your > patch).  We convert 16 or so instances of initialization for "no strdup" > list, but there are about the same number of "strdup" instances still > spelled out: > >    $ git grep -e 'struct string_list [^ ]* = {.*' >    $ git grep -e 'struct string_list [^ ]* = {.*1' > > Wouldn't it be more sensible to use this instead? > >    #define STRING_LIST_INIT(pleasedup) { NULL, 0, 0, (pleasedup) } > This begs for using strdup(string-to-dup) in the macro argument, which will not compile with ancient compilers which don't allow code in an initializer.