Re: [RFC/PATCH 3/9] for-each-ref: add '--points-at' option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Karthik Nayak <karthik.188@xxxxxxxxx> 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.
--
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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]