diff options
author | Eli Zaretskii <eliz@gnu.org> | 2023-04-14 09:21:05 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2023-04-14 09:21:05 +0300 |
commit | 14e809ddff1e60fb53d8570d9b5cfa3cb134858f (patch) | |
tree | 1a7b4a29ad79f6d8ce4665b9eab706dcf159b36b /src/treesit.c | |
parent | 759cdf1e510d9e0689aefeced784fbb81644cd5e (diff) | |
download | emacs-14e809ddff1e60fb53d8570d9b5cfa3cb134858f.tar.gz |
Fix style and unwinding code in treesit.c
This was supposed to be a cherry-pick from master, but
isn't, due to the unnecessary rush to fix master without
cleaning up the mess first and without separating changes
that can and cannot be backported.
* src/treesit.c (treesit_traverse_cleanup_cursor): Fix indentation
style.
(Ftreesit_search_subtree, Ftreesit_search_forward)
(Ftreesit_induce_sparse_tree): Fix specpdl unwinding. (Bug#62823)
Do not merge to master.
Diffstat (limited to 'src/treesit.c')
-rw-r--r-- | src/treesit.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/treesit.c b/src/treesit.c index 7d5d033c02c..53dbeb68882 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -3156,8 +3156,9 @@ treesit_search_forward (TSTreeCursor *cursor, } } -/** Cleanup function for cursor. */ -static void treesit_traverse_cleanup_cursor(void *cursor) +/* Cleanup function for cursor. */ +static void +treesit_traverse_cleanup_cursor(void *cursor) { ts_tree_cursor_delete ((TSTreeCursor *) cursor); } @@ -3213,10 +3214,7 @@ Return the first matched node, or nil if none matches. */) return_value = make_treesit_node (parser, node); } - unbind_to (count, Qnil); - - ts_tree_cursor_delete (&cursor); - return return_value; + return unbind_to (count, return_value); } DEFUN ("treesit-search-forward", @@ -3276,10 +3274,7 @@ always traverse leaf nodes first, then upwards. */) return_value = make_treesit_node (parser, node); } - unbind_to (count, Qnil); - - ts_tree_cursor_delete (&cursor); - return return_value; + return unbind_to (count, return_value); } /* Recursively traverse the tree under CURSOR, and append the result @@ -3402,7 +3397,6 @@ a regexp. */) unbind_to (count, Qnil); - ts_tree_cursor_delete (&cursor); Fsetcdr (parent, Fnreverse (Fcdr (parent))); if (NILP (Fcdr (parent))) return Qnil; |