From a3ce4a4282394e5ed7c548d7e5f8dec145d10230 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 28 Aug 2019 11:17:01 -0700 Subject: [PATCH] Remove some unnecessary global symbols from the library --- lib/src/get_changed_ranges.c | 6 +++--- lib/src/subtree.c | 2 -- lib/src/subtree.h | 3 ++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/src/get_changed_ranges.c b/lib/src/get_changed_ranges.c index 1715716a..5bd1d814 100644 --- a/lib/src/get_changed_ranges.c +++ b/lib/src/get_changed_ranges.c @@ -122,7 +122,7 @@ static bool iterator_done(Iterator *self) { return self->cursor.stack.size == 0; } -Length iterator_start_position(Iterator *self) { +static Length iterator_start_position(Iterator *self) { TreeCursorEntry entry = *array_back(&self->cursor.stack); if (self->in_padding) { return entry.position; @@ -131,7 +131,7 @@ Length iterator_start_position(Iterator *self) { } } -Length iterator_end_position(Iterator *self) { +static Length iterator_end_position(Iterator *self) { TreeCursorEntry entry = *array_back(&self->cursor.stack); Length result = length_add(entry.position, ts_subtree_padding(*entry.subtree)); if (self->in_padding) { @@ -287,7 +287,7 @@ typedef enum { IteratorMatches, } IteratorComparison; -IteratorComparison iterator_compare(const Iterator *old_iter, const Iterator *new_iter) { +static IteratorComparison iterator_compare(const Iterator *old_iter, const Iterator *new_iter) { Subtree old_tree = NULL_SUBTREE; Subtree new_tree = NULL_SUBTREE; uint32_t old_start = 0; diff --git a/lib/src/subtree.c b/lib/src/subtree.c index 2e7d05a7..6a3a63df 100644 --- a/lib/src/subtree.c +++ b/lib/src/subtree.c @@ -18,8 +18,6 @@ typedef struct { Length new_end; } Edit; -TSStateId TS_TREE_STATE_NONE = USHRT_MAX; - #ifdef TREE_SITTER_TEST #define TS_MAX_INLINE_TREE_LENGTH 2 diff --git a/lib/src/subtree.h b/lib/src/subtree.h index 611996d5..79ccd923 100644 --- a/lib/src/subtree.h +++ b/lib/src/subtree.h @@ -5,6 +5,7 @@ extern "C" { #endif +#include #include #include #include "./length.h" @@ -13,7 +14,7 @@ extern "C" { #include "tree_sitter/api.h" #include "tree_sitter/parser.h" -extern TSStateId TS_TREE_STATE_NONE; +static const TSStateId TS_TREE_STATE_NONE = USHRT_MAX; #define NULL_SUBTREE ((Subtree) {.ptr = NULL}) typedef union Subtree Subtree;