Re: [PATCH 2/2] diffcore-pickaxe: terminate grepping as soon as it hits
- From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
- Date
- Aug 17, 2011, 02:44 UTC
- Message-ID
- <CACsJy8AwZqGidC3DYEhXwgutTu3hKhCdHJgaYFA+B1c9Z2qjzA@mail.gmail.com>
- In-Reply-To
- <1313376083-24713-2-git-send-email-pclouds@gmail.com>
diffgrep_consume() already stops regexec() after hitting, so the value of this series is negligible. Tay Ray Chuan seems to touch xdiff code too and my changes are across many files. I'll drop this series.
2011/8/15 Nguyễn Thái Ngọc Duy <pclouds@gmail.com>:
Show 27 quoted lines
> > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > --- > diffcore-pickaxe.c | 6 +----- > 1 files changed, 1 insertions(+), 5 deletions(-) > > diff --git a/diffcore-pickaxe.c b/diffcore-pickaxe.c > index 12811b9..e028dd5 100644 > --- a/diffcore-pickaxe.c > +++ b/diffcore-pickaxe.c > @@ -21,11 +21,7 @@ static int diffgrep_consume(void *priv, char *line, unsigned long len) > if (line[0] != '+' && line[0] != '-') > return 0; > if (data->hit) > - /* > - * NEEDSWORK: we should have a way to terminate the > - * caller early. > - */ > - return 0; > + return -1; > /* Yuck -- line ought to be "const char *"! */ > hold = line[len]; > line[len] = '\0'; > -- > 1.7.4.74.g639db > >
-- Duy