diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-05-01 15:44:29 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-05-01 15:44:29 +0200 |
commit | b84a381c75e50ca0e0a24cc3e152d0c70f8c2c7d (patch) | |
tree | 3998652a44fc333dff2364c3a27f4aac57c322e9 /src/evalvars.c | |
parent | 11abd095210fc84e5dcee87b9baed86061caefe4 (diff) | |
download | vim-git-b84a381c75e50ca0e0a24cc3e152d0c70f8c2c7d.tar.gz |
patch 8.2.0675: Vim9: no support for closuresv8.2.0675
Problem: Vim9: no support for closures.
Solution: Do not re-use stack entries.
Diffstat (limited to 'src/evalvars.c')
-rw-r--r-- | src/evalvars.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/evalvars.c b/src/evalvars.c index f6f077983..08b2990bc 100644 --- a/src/evalvars.c +++ b/src/evalvars.c @@ -2495,19 +2495,19 @@ get_script_local_ht(void) /* * Look for "name[len]" in script-local variables. - * Return -1 when not found. + * Return a non-NULL pointer when found, NULL when not found. */ - int + void * lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED) { hashtab_T *ht = get_script_local_ht(); char_u buffer[30]; char_u *p; - int res; + void *res; hashitem_T *hi; if (ht == NULL) - return -1; + return NULL; if (len < sizeof(buffer) - 1) { vim_strncpy(buffer, name, len); @@ -2517,15 +2517,15 @@ lookup_scriptvar(char_u *name, size_t len, cctx_T *dummy UNUSED) { p = vim_strnsave(name, (int)len); if (p == NULL) - return -1; + return NULL; } hi = hash_find(ht, p); - res = HASHITEM_EMPTY(hi) ? -1 : 1; + res = HASHITEM_EMPTY(hi) ? NULL : hi; // if not script-local, then perhaps imported - if (res == -1 && find_imported(p, 0, NULL) != NULL) - res = 1; + if (res == NULL && find_imported(p, 0, NULL) != NULL) + res = p; if (p != buffer) vim_free(p); |