From f7bf460c877a6c850ec4ccc05f25ca0eb23620ed Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 7 Aug 2017 10:35:06 -0700 Subject: [PATCH] Fix scan-build errors in get_changed_ranges --- src/runtime/get_changed_ranges.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/runtime/get_changed_ranges.c b/src/runtime/get_changed_ranges.c index a9e193d6..17835aa6 100644 --- a/src/runtime/get_changed_ranges.c +++ b/src/runtime/get_changed_ranges.c @@ -2,6 +2,7 @@ #include "runtime/tree.h" #include "runtime/language.h" #include "runtime/error_costs.h" +#include typedef Array(TSRange) RangeArray; @@ -209,12 +210,14 @@ typedef enum { } IteratorComparison; IteratorComparison iterator_compare(const Iterator *old_iter, const Iterator *new_iter) { - Tree *old_tree, *new_tree; - uint32_t old_start, new_start; - TSSymbol old_alias_symbol, new_alias_symbol; + Tree *old_tree = NULL, *new_tree = NULL; + uint32_t old_start = 0, new_start = 0; + TSSymbol old_alias_symbol = 0, new_alias_symbol = 0; iterator_get_visible_state(old_iter, &old_tree, &old_alias_symbol, &old_start); iterator_get_visible_state(new_iter, &new_tree, &new_alias_symbol, &new_start); + assert(old_tree && new_tree); + if (old_alias_symbol == new_alias_symbol) { if (old_start == new_start) { if (!old_tree->has_changes &&