Skip to content

Commit

Permalink
kwcache
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeroen van der Heijden committed Oct 22, 2019
1 parent 060afed commit 89ff7d8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 1 addition & 8 deletions inc/cleri/kwcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@ typedef struct cleri_parse_s cleri_parse_t;
/* private functions */
uint8_t * cleri__kwcache_new(const char * str);
ssize_t cleri__kwcache_match(cleri_parse_t * pr, const char * str);
static inline void cleri__kwcache_free(uint8_t * kwcache);
void cleri__kwcache_free(uint8_t * kwcache);


/*
* Destroy kwcache. (parsing NULL is allowed)
*/
static inline void cleri__kwcache_free(uint8_t * kwcache)
{
free(kwcache);
}

#endif /* CLERI_KWCACHE_H_ */

8 changes: 8 additions & 0 deletions src/kwcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ static void kwcache__kw_match(
? 0
: pcre2_get_ovector_pointer(pr->match_data)[1];
}

/*
* Destroy kwcache. (parsing NULL is allowed)
*/
void cleri__kwcache_free(uint8_t * kwcache)
{
free(kwcache);
}
2 changes: 1 addition & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ cleri_parse_t * cleri_parse2(
void cleri_parse_free(cleri_parse_t * pr)
{
cleri__node_free(pr->tree);
cleri__kwcache_free(pr->kwcache);
free(pr->kwcache);
if (pr->expecting != NULL)
{
cleri__expecting_free(pr->expecting);
Expand Down

0 comments on commit 89ff7d8

Please sign in to comment.