Re: [RFC/PATCH 3/9] for-each-ref: add '--points-at' option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 9, 2015, 19:07 UTC
- Message-ID
- <xmqqvbew66q9.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <5576D591.6030704@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 13 quoted lines
>>> @@ -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
Show 6 quoted lines
>> 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", "e_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.