builtin-grep: -w fix

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2006-05-09 18:27:56 -07:00
parent c39c4f4746
commit 02ab1c490d

View File

@ -241,10 +241,10 @@ static int grep_buffer(struct grep_opt *opt, const char *name,
die("regexp returned nonsense"); die("regexp returned nonsense");
if (pmatch[0].rm_so != 0 && if (pmatch[0].rm_so != 0 &&
word_char(bol[pmatch[0].rm_so-1])) word_char(bol[pmatch[0].rm_so-1]))
continue; /* not a word boundary */ hit = 0;
if ((eol-bol) < pmatch[0].rm_eo && if (pmatch[0].rm_eo != (eol-bol) &&
word_char(bol[pmatch[0].rm_eo])) word_char(bol[pmatch[0].rm_eo]))
continue; /* not a word boundary */ hit = 0;
} }
if (hit) if (hit)
break; break;