On Mon, May 2, 2011 at 8:39 AM, Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> wrote: > Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx> > --- > Âgrep.c |  12 ++++++------ > Âgrep.h |  Â4 +++- > Â2 files changed, 9 insertions(+), 7 deletions(-) > > diff --git a/grep.c b/grep.c > index 63c4280..b8eda9e 100644 > --- a/grep.c > +++ b/grep.c > @@ -70,7 +70,7 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt) >    Âif (p->fixed) >        Âreturn; > > -    err = regcomp(&p->regexp, p->pattern, opt->regflags); > +    err = regcomp(&p->u.regexp, p->pattern, opt->regflags); >    Âif (err) { >        Âchar errbuf[1024]; >        Âchar where[1024]; > @@ -81,8 +81,8 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt) >            Âsprintf(where, "%s, ", p->origin); >        Âelse >            Âwhere[0] = 0; > -        regerror(err, &p->regexp, errbuf, 1024); > -        regfree(&p->regexp); > +        regerror(err, &p->u.regexp, errbuf, 1024); > +        regfree(&p->u.regexp); >        Âdie("%s'%s': %s", where, p->pattern, errbuf); >    Â} > Â} > @@ -320,7 +320,7 @@ void free_grep_patterns(struct grep_opt *opt) >        Âcase GREP_PATTERN: /* atom */ >        Âcase GREP_PATTERN_HEAD: >        Âcase GREP_PATTERN_BODY: > -            regfree(&p->regexp); > +            regfree(&p->u.regexp); >            Âbreak; >        Âdefault: >            Âbreak; > @@ -464,7 +464,7 @@ static int match_one_pattern(struct grep_pat *p, char *bol, char *eol, >    Âif (p->fixed) >        Âhit = !fixmatch(p, bol, eol, pmatch); >    Âelse > -        hit = !regmatch(&p->regexp, bol, eol, pmatch, eflags); > +        hit = !regmatch(&p->u.regexp, bol, eol, pmatch, eflags); > >    Âif (hit && p->word_regexp) { >        Âif ((pmatch[0].rm_so < 0) || > @@ -794,7 +794,7 @@ static int look_ahead(struct grep_opt *opt, >        Âif (p->fixed) >            Âhit = !fixmatch(p, bol, bol + *left_p, &m); >        Âelse > -            hit = !regmatch(&p->regexp, bol, bol + *left_p, &m, 0); > +            hit = !regmatch(&p->u.regexp, bol, bol + *left_p, &m, 0); >        Âif (!hit || m.rm_so < 0 || m.rm_eo < 0) >            Âcontinue; >        Âif (earliest < 0 || m.rm_so < earliest) > diff --git a/grep.h b/grep.h > index 06621fe..9912c11 100644 > --- a/grep.h > +++ b/grep.h > @@ -32,7 +32,9 @@ struct grep_pat { >    Âconst char *pattern; >    Âsize_t patternlen; >    Âenum grep_header_field field; > -    regex_t regexp; > +    union { > +        regex_t regexp; > +    } u; Instead of u, would be worth to rename it to something more descriptive? >    Âunsigned fixed:1; >    Âunsigned ignore_case:1; >    Âunsigned word_regexp:1; > -- > 1.7.5.349.gfeb1a > > -- > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html > ÿô.nÇ·®+%˱é¥wÿº{.nÇ· ßØnr¡öë¨è&£ûz¹Þúzf£¢·h§~Ûÿÿïÿê_èæ+v¨þ)ßø