diff options
Diffstat (limited to 'src')
| -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, | |||
| 3156 | } | 3156 | } |
| 3157 | } | 3157 | } |
| 3158 | 3158 | ||
| 3159 | /** Cleanup function for cursor. */ | 3159 | /* Cleanup function for cursor. */ |
| 3160 | static void treesit_traverse_cleanup_cursor(void *cursor) | 3160 | static void |
| 3161 | treesit_traverse_cleanup_cursor(void *cursor) | ||
| 3161 | { | 3162 | { |
| 3162 | ts_tree_cursor_delete ((TSTreeCursor *) cursor); | 3163 | ts_tree_cursor_delete ((TSTreeCursor *) cursor); |
| 3163 | } | 3164 | } |
| @@ -3213,10 +3214,7 @@ Return the first matched node, or nil if none matches. */) | |||
| 3213 | return_value = make_treesit_node (parser, node); | 3214 | return_value = make_treesit_node (parser, node); |
| 3214 | } | 3215 | } |
| 3215 | 3216 | ||
| 3216 | unbind_to (count, Qnil); | 3217 | return unbind_to (count, return_value); |
| 3217 | |||
| 3218 | ts_tree_cursor_delete (&cursor); | ||
| 3219 | return return_value; | ||
| 3220 | } | 3218 | } |
| 3221 | 3219 | ||
| 3222 | DEFUN ("treesit-search-forward", | 3220 | DEFUN ("treesit-search-forward", |
| @@ -3276,10 +3274,7 @@ always traverse leaf nodes first, then upwards. */) | |||
| 3276 | return_value = make_treesit_node (parser, node); | 3274 | return_value = make_treesit_node (parser, node); |
| 3277 | } | 3275 | } |
| 3278 | 3276 | ||
| 3279 | unbind_to (count, Qnil); | 3277 | return unbind_to (count, return_value); |
| 3280 | |||
| 3281 | ts_tree_cursor_delete (&cursor); | ||
| 3282 | return return_value; | ||
| 3283 | } | 3278 | } |
| 3284 | 3279 | ||
| 3285 | /* Recursively traverse the tree under CURSOR, and append the result | 3280 | /* Recursively traverse the tree under CURSOR, and append the result |
| @@ -3402,7 +3397,6 @@ a regexp. */) | |||
| 3402 | 3397 | ||
| 3403 | unbind_to (count, Qnil); | 3398 | unbind_to (count, Qnil); |
| 3404 | 3399 | ||
| 3405 | ts_tree_cursor_delete (&cursor); | ||
| 3406 | Fsetcdr (parent, Fnreverse (Fcdr (parent))); | 3400 | Fsetcdr (parent, Fnreverse (Fcdr (parent))); |
| 3407 | if (NILP (Fcdr (parent))) | 3401 | if (NILP (Fcdr (parent))) |
| 3408 | return Qnil; | 3402 | return Qnil; |