On Tue, Jun 29, 2010 at 07:43, Junio C Hamano <gitster@xxxxxxxxx> wrote: >>> >>> #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. > > Err, one of us must be confused. > > I was suggesting to rewrite things like these, found in builtin/remote.c > (add and rm): > > struct string_list track = { NULL, 0, 0, 0 }; > struct string_list branches = { NULL, 0, 0, 1 }; > That must be me, again. Didn't bother to check the string_list definition and naively assumed the pleasedup was for an initialization string. I thought that depending on usage the caller may wish to either copy it or leave the string_list referncing the original. Which cannot be the case with string_list, indeed. BTW, now that I took a look at it... The iteration over string_list items looks a little overengineered. At least from the point of view of the existing users of the feature. Wouldn't a simple loop be just as simple to use (if not simplier) and faster (no uninlineable function calls and argument preparation and passing needed)? #define string_list_foreach(item,list) \ for (item = (list)->items; item < (list)->items + (list)->nr; ++item) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html