From 099f178d0e247837af5e1a84556aee558a4d0af6 Mon Sep 17 00:00:00 2001 From: Logan007 Date: Thu, 6 Aug 2020 15:59:35 +0545 Subject: [PATCH] adopted re_match for the sake of completeness, too --- src/n2n_regex.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/n2n_regex.c b/src/n2n_regex.c index e093c4c..627e0f4 100644 --- a/src/n2n_regex.c +++ b/src/n2n_regex.c @@ -91,7 +91,14 @@ static int ismetachar(char c); /* Public functions: */ int re_match(const char* pattern, const char* text, int* matchlength) { - return re_matchp(re_compile(pattern), text, matchlength); + re_t re_p; /* pointer to (to be created) copy of compiled regex */ + int ret = -1; + + re_p = re_compile (pattern); + ret = re_matchp(re_p, text, matchlength); + free(re_p); + + return(ret); } int re_matchp(re_t pattern, const char* text, int* matchlength)