diff options
Diffstat (limited to 'regexset.c')
-rw-r--r-- | regexset.c | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -23,7 +23,7 @@ static void re_error(const char *name, const char *pattern, const char *error, i regexes = realloc(regexes, --rs_count * sizeof(struct regexset_t)); } -struct regexset_t *rs_add(const char *text, const char *join) { +struct regexset_t *rs_add(const char *text, const char *join, const char *kick) { regexes = realloc(regexes, ++rs_count * sizeof(struct regexset_t)); if(!regexes) { /* If we end up here, we cannot free any previously compiled pcre patterns. */ @@ -55,6 +55,20 @@ struct regexset_t *rs_add(const char *text, const char *join) { } rs->join_e = pcre_study(rs->join, 0, &error); + rs->kick = pcre_compile(kick, 0, &error, &erroffset, rs_pcre_tables); + if(rs->kick == NULL) { + pcre_free(rs->text); + pcre_free(rs->join); + if(rs->text_e) { + pcre_free(rs->text_e); + pcre_free(rs->join_e); + } + re_error("kick", kick, error, erroffset); + return NULL; + + } + rs->kick_e = pcre_study(rs->kick, 0, &error); + return rs; } @@ -70,6 +84,9 @@ void rs_free() { pcre_free(regexes[i].join); if(regexes[i].join_e) pcre_free(regexes[i].join_e); + pcre_free(regexes[i].kick); + if(regexes[i].kick_e) + pcre_free(regexes[i].kick_e); } free(regexes); regexes = NULL; |