87 |
return rc; |
return rc; |
88 |
} |
} |
89 |
|
|
90 |
|
static int |
91 |
|
_posix_refcnt(regex_t *re) |
92 |
|
{ |
93 |
|
return re->re_nsub; |
94 |
|
} |
95 |
|
|
96 |
#ifdef HAVE_PCRE |
#ifdef HAVE_PCRE |
97 |
int |
static int |
98 |
_perl_match(pcre *re, char *line, int *refc, char ***refv) |
_perl_match(pcre *re, char *line, int *refc, char ***refv) |
99 |
{ |
{ |
100 |
int rc; |
int rc; |
143 |
xfree(ovector); |
xfree(ovector); |
144 |
return rc; |
return rc; |
145 |
} |
} |
146 |
|
|
147 |
|
static int |
148 |
|
_perl_refcnt(pcre *re) |
149 |
|
{ |
150 |
|
int count = 0; |
151 |
|
|
152 |
|
pcre_fullinfo(re, NULL, PCRE_INFO_CAPTURECOUNT, &count); |
153 |
|
return count; |
154 |
|
} |
155 |
#endif |
#endif |
156 |
|
|
157 |
int |
int |
164 |
return !_posix_match(&re->v.re, line, refc, refv); |
return !_posix_match(&re->v.re, line, refc, refv); |
165 |
} |
} |
166 |
|
|
167 |
|
int |
168 |
|
anubis_regex_refcnt(RC_REGEX *re) |
169 |
|
{ |
170 |
|
#ifdef HAVE_PCRE |
171 |
|
if (re->perlre) |
172 |
|
return _perl_refcnt(re->v.pre); |
173 |
|
#endif |
174 |
|
return _posix_refcnt(&re->v.re); |
175 |
|
} |
176 |
|
|
177 |
RC_REGEX * |
RC_REGEX * |
178 |
anubis_regex_compile(char *line, int opt) |
anubis_regex_compile(char *line, int opt) |
179 |
{ |
{ |