From: Karthik Nayak Date: Wed, 10 Jun 2015 06:55:19 GMT Subject: Re: [RFC/PATCH 3/9] for-each-ref: add '--points-at' option Message-ID: <5577DF57.2020607@gmail.com> In-Reply-To: On 06/10/2015 12:37 AM, Junio C Hamano wrote: > Karthik Nayak 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", "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. > Will do, thanks! -- Regards, Karthik