tree-sitter/lib/src
Patrick Thomson 6e2a60629c Make ts_tree_delete and ts_parser_delete NULL-safe.
Historically, `free(3)`-style functions have been NULL-safe, to make
resource handling functions more robust. This doesn't seem to be the
case with tree-sitter's `ts_tree_delete` and `ts_parser_delete` C
functions, which immediately dereference the passed pointer. This
leads to complexity in client libraries that have to ensure that trees
and parsers are cleaned up correctly.

This patch adds NULL checks to `parse_delete` and `tree_delete`. They
should have negligable performance impacts, since null checks are fast.

I didn't change the internal _delete functions, as arguably those
being NULL-unsafe is a feature, not a bug.
2019-05-30 11:47:56 -04:00
..
alloc.h Tests: Prevent array reallocations during ts_stack_print_dot_graph 2019-03-14 13:59:12 -07:00
array.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
atomic.h Use a size_t instead of a uint32_t for cancellation flag 2019-03-21 11:26:05 -07:00
clock.h Use explicit syntax for functions with no parameters 2019-03-21 16:06:06 -07:00
error_costs.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
get_changed_ranges.c Merge branch 'master' into node-fields 2019-03-26 11:58:21 -07:00
get_changed_ranges.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
language.c Fix errors in when languages have no fields 2019-02-12 17:20:12 -08:00
language.h Fix errors in when languages have no fields 2019-02-12 17:20:12 -08:00
length.h Use explicit syntax for functions with no parameters 2019-03-21 16:06:06 -07:00
lexer.c Update include paths to not reference 'runtime' directory 2019-01-04 17:33:34 -08:00
lexer.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
lib.c Fix warning about undefined snprintf 2019-03-08 21:22:13 -08:00
node.c In node range queries, treat the end coordinate as exclusive 2019-04-26 13:36:28 -07:00
parser.c Make ts_tree_delete and ts_parser_delete NULL-safe. 2019-05-30 11:47:56 -04:00
point.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
reduce_action.h Generate node-fields.json file 2019-02-12 11:06:18 -08:00
reusable_node.h Use explicit syntax for functions with no parameters 2019-03-21 16:06:06 -07:00
stack.c Fix handling of zero-width external tokens at beginning of document 2019-04-08 15:01:52 -07:00
stack.h Swap two incorrectly placed comments 2019-03-26 16:53:35 +01:00
subtree.c lib: Include fields in ts_node_string output 2019-02-13 09:47:21 -08:00
subtree.h Generate node-fields.json file 2019-02-12 11:06:18 -08:00
tree.c Make ts_tree_delete and ts_parser_delete NULL-safe. 2019-05-30 11:47:56 -04:00
tree.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00
tree_cursor.c Fix errors in when languages have no fields 2019-02-12 17:20:12 -08:00
tree_cursor.h Fully implement ts_node_child_by_field_id 2019-02-08 15:16:56 -08:00
utf16.c Update include paths to not reference 'runtime' directory 2019-01-04 17:33:34 -08:00
utf16.h Just call the C lib 'the library' everywhere, don't call it a 'runtime' 2019-01-10 15:22:39 -08:00