Fix a few small bugs.

This commit is contained in:
Danila Fedorin 2017-01-07 22:15:18 -08:00
parent 452b6e660e
commit a2044b596a
2 changed files with 3 additions and 2 deletions

View File

@ -301,7 +301,7 @@ void regex_node_clear(regex_node* node);
* Frees an entire NFA, starting from the given root node.
* @param root the root, or starting node, of the NFA.
*/
void regex_free(regex_node* root);
libregex_result regex_free(regex_node* root);
/**
* Builds a regular expression from the given regular expression strings.
* @param root the root node to build into.

View File

@ -78,6 +78,7 @@ libregex_result _regex_node_create_group(regex_node** open, regex_node** close,
} else {
free(*open);
free(*close);
*open = *close = NULL;
}
return result;
}
@ -149,7 +150,7 @@ void _regex_chain_append_chain(regex_chain* append_to, regex_chain* to_append){
libregex_result _regex_find_all(regex_node* node, ll* append_to, int tag_with){
libregex_result result = LIBREGEX_SUCCESS;
if(node->list_id != tag_with){
if(node && node->list_id != tag_with){
node->list_id = tag_with;
if(node->type == REGEX_VALUE){
result = _regex_find_all(node->data_u.value_s.next, append_to, tag_with);