On 06/10/2015 12:37 AM, Junio C Hamano wrote:
Karthik Nayak <karthik....@gmail.com> writes:

>>> @@ -54,7 +59,6 @@ int cmd_for_each_ref(int argc, const char **argv, const 
char *prefix)
>>>        /* for warn_ambiguous_refs */
>>>        git_config(git_default_config, NULL);
>>>
>>> -    memset(&ref_cbdata, 0, sizeof(ref_cbdata));
>>
>> I cannot quite see how this change relates to the addition of the
>> new option.
>>
>
> Well if we memset() after calling parse_opt_points_at(), we loose all
> the information we would have obtained.
> So the memset() is moved to an earlier location.

which I did not see, because I expected the code to follow the usual
"no decl-after-statement" pattern.  IOW

>>        int maxcount = 0, quote_style = 0;
>>        struct ref_filter_cbdata ref_cbdata;
>> +    memset(&ref_cbdata, 0, sizeof(ref_cbdata));
>>
>>        struct option opts[] = {
>>            OPT_BIT('s', "shell", &quote_style,

Don't do that.  Always start your function like so:

    type funcname(args)
         {
             declarations;

                 first statement;
        ...

with no blank line within declarations block and a blank line after
the declarations block.

Will do, thanks!

--
Regards,
Karthik
--
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