Fix a few more bugs in helper functions.

This commit is contained in:
Danila Fedorin 2017-01-21 21:18:55 -08:00
parent 16832e98a9
commit d8ddaa8b45

View File

@ -90,7 +90,7 @@ liblex_result _pattern_chain_create(pattern_chain** into, pattern_node* from, pa
(*into)->head = from;
(*into)->tail = to;
} else {
result = LIBLEX_SUCCESS;
result = LIBLEX_MALLOC;
}
return result;
}
@ -120,7 +120,7 @@ void _pattern_node_append_node(pattern_node* append_to, pattern_node* to_append)
void _pattern_chain_append_node(pattern_chain* append_to, pattern_node* to_append){
if(append_to && to_append){
pattern_node** next_node = (append_to->head) ? &append_to->head : _pattern_node_get_next(append_to->tail);
pattern_node** next_node = (append_to->head == NULL) ? &append_to->head : _pattern_node_get_next(append_to->tail);
if(next_node) {
*next_node = append_to->tail = to_append;
}