Mercurial > vim
diff src/syntax.c @ 29892:db0939444c96 v9.0.0284
patch 9.0.0284: using static buffer for multiple completion functions
Commit: https://github.com/vim/vim/commit/5ff595d9db2d9a33aa10cc9f18f256826226862f
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 26 22:36:41 2022 +0100
patch 9.0.0284: using static buffer for multiple completion functions
Problem: Using static buffer for multiple completion functions.
Solution: Use one buffer in expand_T.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 26 Aug 2022 23:45:03 +0200 |
parents | 80929331a836 |
children | 029c59bf78f1 |
line wrap: on
line diff
--- a/src/syntax.c +++ b/src/syntax.c @@ -6420,11 +6420,8 @@ set_context_in_syntax_cmd(expand_T *xp, * expansion. */ char_u * -get_syntax_name(expand_T *xp UNUSED, int idx) +get_syntax_name(expand_T *xp, int idx) { -#define CBUFFER_LEN 256 - static char_u cbuffer[CBUFFER_LEN]; // TODO: better solution - switch (expand_what) { case EXP_SUBCMD: @@ -6452,9 +6449,9 @@ get_syntax_name(expand_T *xp UNUSED, int { if (idx < curwin->w_s->b_syn_clusters.ga_len) { - vim_snprintf((char *)cbuffer, CBUFFER_LEN, "@%s", + vim_snprintf((char *)xp->xp_buf, EXPAND_BUF_LEN, "@%s", SYN_CLSTR(curwin->w_s)[idx].scl_name); - return cbuffer; + return xp->xp_buf; } else return NULL;