This just makes these functions easier to understand all around. In
the case of _token_list_append_list this is an actual bug fix, (where
append an empty list onto a non-empty list would previously scramble
the tail pointer of the original list).
void
_token_list_append_list (token_list_t *list, token_list_t *tail)
{
+ if (tail == NULL || tail->head == NULL)
+ return;
+
if (list->head == NULL) {
list->head = tail->head;
} else {
token_list_t *intermediate, *list_orig = list;
int i, need_rescan = 0;
- if (list == NULL)
+ if (list == NULL || list->head == NULL)
return;
intermediate = _token_list_create (parser);