From: Bert Wesarg Date: Mon, 02 May 2011 14:29:31 GMT Subject: Re: [PATCH/RFC 2/4] grep: pass current line number down to match_one_pattern Message-ID: In-Reply-To: On Mon, May 2, 2011 at 15:30, Thiago Farina wrote: > On Mon, May 2, 2011 at 8:39 AM, Bert Wesarg wrote: >> Signed-off-by: Bert Wesarg >> --- >>  grep.c |   42 +++++++++++++++++++++--------------------- >>  1 files changed, 21 insertions(+), 21 deletions(-) >> >> diff --git a/grep.c b/grep.c >> index b8eda9e..f21b022 100644 >> --- a/grep.c >> +++ b/grep.c >> @@ -437,7 +437,7 @@ static struct { >>  }; >> >>  static int match_one_pattern(struct grep_pat *p, char *bol, char *eol, >> -                            enum grep_context ctx, >> +                            unsigned lno, enum grep_context ctx, > > I'd rename lno to line_nr, so it's more clearer. Also, I'd add the new > paramenter at the end, not in some random position (or was there some > particular reason to put here but not in the end?). lno is already in use in this file, so I followed here the precept. The position was chosen, because bol/eol is the line content to match, so the line number should probably be near the content parameter. Bert > >>                             regmatch_t *pmatch, int eflags) >>  { >>        int hit = 0;