Mercurial > vim
diff src/insexpand.c @ 31859:8b15e4161605 v9.0.1262
patch 9.0.1262: the did_set_string_option function is too long
Commit: https://github.com/vim/vim/commit/f2e30d0c448b9754d0d4daa901b51fbbf4c30747
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Jan 30 13:04:42 2023 +0000
patch 9.0.1262: the did_set_string_option function is too long
Problem: The did_set_string_option function is too long.
Solution: Split off functionality to individual functions. (Yegappan
Lakshmanan, Lewis Russell, closes #11904)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 30 Jan 2023 14:15:05 +0100 |
parents | 50555279168b |
children | ca6bc7c04163 |
line wrap: on
line diff
--- a/src/insexpand.c +++ b/src/insexpand.c @@ -2545,16 +2545,15 @@ copy_global_to_buflocal_cb(callback_T *g * name of a function (string), or function(<name>) or funcref(<name>) or a * lambda expression. */ - int + char * set_completefunc_option(void) { - int retval; - - retval = option_set_callback_func(curbuf->b_p_cfu, &cfu_cb); - if (retval == OK) - set_buflocal_cfu_callback(curbuf); - - return retval; + if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL) + return e_invalid_argument; + + set_buflocal_cfu_callback(curbuf); + + return NULL; } /* @@ -2575,16 +2574,14 @@ set_buflocal_cfu_callback(buf_T *buf UNU * name of a function (string), or function(<name>) or funcref(<name>) or a * lambda expression. */ - int + char * set_omnifunc_option(void) { - int retval; - - retval = option_set_callback_func(curbuf->b_p_ofu, &ofu_cb); - if (retval == OK) - set_buflocal_ofu_callback(curbuf); - - return retval; + if (option_set_callback_func(curbuf->b_p_ofu, &ofu_cb) == FAIL) + return e_invalid_argument; + + set_buflocal_ofu_callback(curbuf); + return NULL; } /* @@ -2605,7 +2602,7 @@ set_buflocal_ofu_callback(buf_T *buf UNU * name of a function (string), or function(<name>) or funcref(<name>) or a * lambda expression. */ - int + char * set_thesaurusfunc_option(void) { int retval; @@ -2622,7 +2619,7 @@ set_thesaurusfunc_option(void) retval = option_set_callback_func(p_tsrfu, &tsrfu_cb); } - return retval; + return retval == FAIL ? e_invalid_argument : NULL; } /*