diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-04-17 17:23:47 +0100 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2023-04-28 23:04:09 +0800 |
commit | ff34c91194f9ab9d02808f2880029c38a4655eb5 (patch) | |
tree | fc0eb2a8e58b92e6af59411165a0127af63dd552 /src/nvim/tag.c | |
parent | 715587f8e44e941ece6f17eb77620fd1b4719496 (diff) | |
download | rneovim-ff34c91194f9ab9d02808f2880029c38a4655eb5.tar.gz rneovim-ff34c91194f9ab9d02808f2880029c38a4655eb5.tar.bz2 rneovim-ff34c91194f9ab9d02808f2880029c38a4655eb5.zip |
vim-patch:9.0.1330: handling new value of an option has a long "else if" chain
Problem: Handling new value of an option has a long "else if" chain.
Solution: Use a function pointer. (Yegappan Lakshmanan, closes vim/vim#12015)
https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e
Diffstat (limited to 'src/nvim/tag.c')
-rw-r--r-- | src/nvim/tag.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 19c62e2b0e..2ee1a0335b 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -210,20 +210,23 @@ static Callback tfu_cb; // 'tagfunc' callback function /// Reads the 'tagfunc' option value and convert that to a callback value. /// Invoked when the 'tagfunc' option is set. The option value can be a name of /// a function (string), or function(<name>) or funcref(<name>) or a lambda. -void set_tagfunc_option(const char **errmsg) +const char *did_set_tagfunc(optset_T *args) { + buf_T *buf = (buf_T *)args->os_buf; + callback_free(&tfu_cb); - callback_free(&curbuf->b_tfu_cb); + callback_free(&buf->b_tfu_cb); - if (*curbuf->b_p_tfu == NUL) { - return; + if (*buf->b_p_tfu == NUL) { + return NULL; } - if (option_set_callback_func(curbuf->b_p_tfu, &tfu_cb) == FAIL) { - *errmsg = e_invarg; + if (option_set_callback_func(buf->b_p_tfu, &tfu_cb) == FAIL) { + return e_invarg; } - callback_copy(&curbuf->b_tfu_cb, &tfu_cb); + callback_copy(&buf->b_tfu_cb, &tfu_cb); + return NULL; } #if defined(EXITFREE) |