Re: [PATCH/RFC 2/4] grep: pass current line number down to match_one_pattern
- From
Bert Wesarg <bert.wesarg@googlemail.com>
- Date
- May 2, 2011, 14:29 UTC
- Message-ID
- <BANLkTimr7A64OYB51kSWe7pkjYaiOZy-ZQ@mail.gmail.com>
- In-Reply-To
- <BANLkTi=HtStcEFezT9sEeRFzsGw1mMyg7Q@mail.gmail.com>
On Mon, May 2, 2011 at 15:30, Thiago Farina <tfransosi@gmail.com> wrote:
Show 20 quoted lines
> On Mon, May 2, 2011 at 8:39 AM, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
>> ---
>> 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;