add jairee_match_free()

This commit is contained in:
Josh Holtrop 2019-10-29 19:23:29 -04:00
parent 241c4267e4
commit ef31aa5959
3 changed files with 8 additions and 0 deletions

View File

@ -86,6 +86,11 @@ jairee_match_t * jairee_matchc(jairee_string_t * str, size_t start_offset, jaire
return match; return match;
} }
void jairee_match_free(jairee_match_t * match)
{
free(match);
}
static jairee_cp_t decode_ascii(const void * s, size_t * offset) static jairee_cp_t decode_ascii(const void * s, size_t * offset)
{ {
jairee_cp_t cp = (jairee_cp_t)((const char *)s)[*offset]; jairee_cp_t cp = (jairee_cp_t)((const char *)s)[*offset];

View File

@ -47,6 +47,8 @@ void jairee_re_free(jairee_re_t * re);
jairee_match_t * jairee_matchc(jairee_string_t * str, size_t start_offset, jairee_re_t * re); jairee_match_t * jairee_matchc(jairee_string_t * str, size_t start_offset, jairee_re_t * re);
void jairee_match_free(jairee_match_t * match);
#if 0 #if 0
jairee_match_t * jairee_match(jairee_string_t * str, size_t start_offset, jairee_string_t * exp); jairee_match_t * jairee_match(jairee_string_t * str, size_t start_offset, jairee_string_t * exp);

View File

@ -43,6 +43,7 @@ static void test_basic_re()
TEST(match->start == 0u); TEST(match->start == 0u);
TEST(match->end == 4u); TEST(match->end == 4u);
TEST(match->next == NULL); TEST(match->next == NULL);
jairee_match_free(match);
jairee_string_free(s); jairee_string_free(s);
} }