diff.c: associate a flag with each pattern and use it for compiling regex

This is in preparation for allowing extended regular expression patterns.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brandon Casey
2008-09-18 17:42:48 -05:00
committed by Junio C Hamano
parent 45e7ca0f0e
commit a013585b20
3 changed files with 15 additions and 12 deletions

View File

@ -206,7 +206,7 @@ static long ff_regexp(const char *line, long len,
return result;
}
void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value)
void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value, int cflags)
{
int i;
struct ff_regs *regs;
@ -231,7 +231,7 @@ void xdiff_set_find_func(xdemitconf_t *xecfg, const char *value)
expression = buffer = xstrndup(value, ep - value);
else
expression = value;
if (regcomp(&reg->re, expression, 0))
if (regcomp(&reg->re, expression, cflags))
die("Invalid regexp to look for hunk header: %s", expression);
free(buffer);
value = ep + 1;