Tanay Abhra <tanay...@gmail.com> writes:

> On 06/16/2014 03:59 PM, Junio C Hamano wrote:
>> Tanay Abhra <tanay...@gmail.com> writes:
>>> When a compound construct like a string_list within another
>>> struct is used, the default initializer macros are useless.
>>> For such cases add helper functions for string_list
>>> initialization for both DUP and NODUP modes.
>>> Signed-off-by: Tanay Abhra <tanay...@gmail.com>
>>> ---
>> Sorry, but I do not understand the above "useless".  Do you mean to
>> say that xyzzy below cannot be initialized that way?
>>  ...
> I was actually explaining for cases like below,
> ...
> +             string_list_init_dup(&e->value_list);

If that is what you wanted to refer to, I would have to say
"useless" is placing a stress on a wrong place.  (I do not see
anything wrong with your new code; it was just the way it was
explained in the proposed log message was misleading).

Structure initialisers are not something you can assign to a
variable anyway, and calling them "useless" is like complaining how
unwieldty hammers are on screws.  "Hammers are useless on screws"
may not be technically wrong per-se, but the readers won't be helped
by hearing it very much.

Instead, you would want to explain what your new invention, a
screwdriver, is and how it is intended to be used.

We of course have precedences for this kind of thing.  STRBUF_INIT
is for definition-time initialisation and strbuf_init() is to
initialise an uninitialised piece of memory to be used as a strbuf.

I tend to think it was a long-time misdesign of string-list API to
have the STRING_LIST_INIT* definition-time initialisers without
having runtime string_list_init*() initialisers, and it is a good
idea to add them to complete the API.

If I were writing the log message for this, I would just say:

        The string-list API has STRING_LIST_INIT_* macros to be used
        to define variables with initialisers, but lacks functions
        to initialise an uninitialised piece of memory to be used as
        a string-list at the run-time.

        Introduce string_list_init_{dup,nodup}() functions for that.

or something.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to