Mercurial > vim
diff src/vim9execute.c @ 30423:221cca379bd5 v9.0.0547
patch 9.0.0547: looping over empty out_loop[] entries
Commit: https://github.com/vim/vim/commit/6d313bec535d9ccc24f6f82025280a61caad7416
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 22 16:36:25 2022 +0100
patch 9.0.0547: looping over empty out_loop[] entries
Problem: Looping over empty out_loop[] entries.
Solution: Store the array size.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 22 Sep 2022 17:45:03 +0200 |
parents | dac4fe437840 |
children | 4198995b9210 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1868,7 +1868,10 @@ fill_partial_and_closure( pt->pt_outer.out_loop[depth].var_count = lvi->lvi_loop[depth].var_count; } + pt->pt_outer.out_loop_size = lvi->lvi_depth; } + else + pt->pt_outer.out_loop_size = 0; // If the function currently executing returns and the closure is still // being referenced, we need to make a copy of the context (arguments @@ -5739,14 +5742,10 @@ call_def_function( if (partial != NULL) { outer_T *outer = get_pt_outer(partial); - int depth; - void *ptr = outer->out_stack; - - // see if any stack was set - for (depth = 0; ptr == NULL && depth < MAX_LOOP_DEPTH; ++depth) - ptr = outer->out_loop[depth].stack; - if (ptr == NULL) + + if (outer->out_stack == NULL && outer->out_loop_size == 0) { + // no stack was set if (current_ectx != NULL) { if (current_ectx->ec_outer_ref != NULL