Re: [PATCH 03/83] builtin/apply: avoid parameter shadowing 'linenr' global
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 27, 2016, 16:27 UTC
- Message-ID
- <xmqqtwin9fus.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <1461504863-15946-4-git-send-email-chriscool@tuxfamily.org>
Christian Couder <christian.couder@gmail.com> writes:
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> > ---
I think 02/83 that renamed the global-to-be-moved-to-state to state_p_value was brilliant, and this should follow suit; you would be moving linenr into the state eventually in later steps, right?
Show 24 quoted lines
> builtin/apply.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/apply.c b/builtin/apply.c
> index e133b38..7115dc2 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -1516,7 +1516,7 @@ static int find_header(const char *line, unsigned long size, int *hdrsize, struc
> return -1;
> }
>
> -static void record_ws_error(unsigned result, const char *line, int len, int linenr)
> +static void record_ws_error(unsigned result, const char *line, int len, int l_nr)
> {
> char *err;
>
> @@ -1530,7 +1530,7 @@ static void record_ws_error(unsigned result, const char *line, int len, int line
>
> err = whitespace_error_string(result);
> fprintf(stderr, "%s:%d: %s.\n%.*s\n",
> - patch_input_file, linenr, err, len, line);
> + patch_input_file, l_nr, err, len, line);
> free(err);
> }