summaryrefslogtreecommitdiff
path: root/regexset.c
diff options
context:
space:
mode:
Diffstat (limited to 'regexset.c')
-rw-r--r--regexset.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/regexset.c b/regexset.c
index 657978a..c816217 100644
--- a/regexset.c
+++ b/regexset.c
@@ -39,15 +39,19 @@ struct regexset_t *rs_add(const char *text, const char *join) {
re_error("text", text, error, erroffset);
return NULL;
}
+ rs->text_e = pcre_study(rs->text, 0, &error);
/* Free compiled patterns from this point when failing. */
rs->join = pcre_compile(join, 0, &error, &erroffset, NULL);
if(rs->join == NULL) {
pcre_free(rs->text);
+ if(rs->text_e)
+ pcre_free(rs->text_e);
re_error("join", join, error, erroffset);
return NULL;
}
+ rs->join_e = pcre_study(rs->join, 0, &error);
return rs;
}
@@ -59,7 +63,11 @@ struct regexset_t *rs_get(int index) {
void rs_free() {
for(int i = 0; i < rs_count; i++) {
pcre_free(regexes[i].text);
+ if(regexes[i].text_e)
+ pcre_free(regexes[i].text_e);
pcre_free(regexes[i].join);
+ if(regexes[i].join_e)
+ pcre_free(regexes[i].join_e);
}
free(regexes);
regexes = NULL;