Fix some errors caught by clang static analyzer

This commit is contained in:
Max Brunsfeld 2016-01-15 13:33:05 -08:00
parent 04afda2e66
commit 19b776e74d
2 changed files with 3 additions and 4 deletions

View file

@ -81,7 +81,7 @@ static void ts_parser__breakdown_top_of_stack(TSParser *self, int head) {
}
free(removed_trees);
} while (last_child->child_count > 0);
} while (last_child && last_child->child_count > 0);
}
static void ts_parser__pop_reusable_subtree(LookaheadState *state);
@ -664,8 +664,7 @@ TSTree *ts_parser_parse(TSParser *self, TSInput input, TSTree *previous_tree) {
for (;;) {
TSTree *lookahead = NULL;
TSLength last_position = ts_length_zero();
TSLength position = ts_length_zero();
TSLength last_position, position = ts_length_zero();
self->is_split = ts_stack_head_count(self->stack) > 1;

View file

@ -299,8 +299,8 @@ Vector ts_stack_pop(Stack *self, int head_index, int child_count,
vector_push(&path->trees, &node->entry.tree);
path->node = path->node->successors[0];
PopPath path_copy = *path;
for (int j = 1; j < node->successor_count; j++) {
PopPath path_copy = *path;
vector_push(&self->pop_paths, &path_copy);
PopPath *next_path = vector_back(&self->pop_paths);
next_path->node = node->successors[j];