diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-01-25 13:46:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 13:46:23 +0000 |
commit | e2a9d71521a1acdc5a554e3d9f54dfe543914db5 (patch) | |
tree | 07b5ac97f4770df35d8cf412b0a9c24f8c3a576d /src/nvim/tag.c | |
parent | b8288df99be8df701308167e4b0b497f003f25e9 (diff) | |
parent | 7bee622fdc72d7461ed43ea170cca20056891d2c (diff) | |
download | rneovim-e2a9d71521a1acdc5a554e3d9f54dfe543914db5.tar.gz rneovim-e2a9d71521a1acdc5a554e3d9f54dfe543914db5.tar.bz2 rneovim-e2a9d71521a1acdc5a554e3d9f54dfe543914db5.zip |
Merge pull request #21885 from lewis6991/refactor/options
Problems:
- Scope of local variables in options code is too large.
- did_set_string_option() is too large (>1000LOC).
- Setting options for a particular window or buffer requires a changing context (assigning curwin/curbuf).
Solutions:
- Reduce the scope of local variables.
- Break up did_set_string_option so it doesn't contain specific logic about each individual option (1038 LOC -> 310 LOC).
- Begin work on making functions not depend on curbuf or curwin and pass window or buffer handles explicitly.
Diffstat (limited to 'src/nvim/tag.c')
-rw-r--r-- | src/nvim/tag.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 18c7684584..197184c181 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -210,22 +210,20 @@ 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. -int set_tagfunc_option(void) +void set_tagfunc_option(char **errmsg) { callback_free(&tfu_cb); callback_free(&curbuf->b_tfu_cb); if (*curbuf->b_p_tfu == NUL) { - return OK; + return; } if (option_set_callback_func(curbuf->b_p_tfu, &tfu_cb) == FAIL) { - return FAIL; + *errmsg = e_invarg; } callback_copy(&curbuf->b_tfu_cb, &tfu_cb); - - return OK; } #if defined(EXITFREE) |