Re: [RFC] introducing git replay
On Wed, Apr 13, 2022 at 3:27 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 17 quoted lines
> Edmundo Carmona Antoranz <eantoranz@gmail.com> writes:
> > +static unsigned int replay_indexof(struct commit *commit,
> > + struct commit_list *list)
> > +{
> > + int res;
> > + if (list == NULL)
> > + return -1;
>
> We encourage to have a blank line between the end of the decls and
> the beginning of the statements. Add one after the line that
> declares the variable "res".
>
> In an existing code that consistently uses the abbreviation, it is a
> different story, but "result" is not too long to spell out, and
> because you do not use the variable that often anyway, you would
> avoid unnecessary friction on the readers not to abbreviate it to
> "res" here.One other minor point... in Git source code, comparison against NULL is spelled:
if (!list)
...(And the inverse case of `if (list != NULL)` would just be `if (list)`.)