forked from aniani/vim
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)
This commit is contained in:
parent
2a99fe6c41
commit
f2e30d0c44
@ -73,16 +73,22 @@ xim_log(char *s, ...)
|
||||
static callback_T imaf_cb; // 'imactivatefunc' callback function
|
||||
static callback_T imsf_cb; // 'imstatusfunc' callback function
|
||||
|
||||
int
|
||||
char *
|
||||
set_imactivatefunc_option(void)
|
||||
{
|
||||
return option_set_callback_func(p_imaf, &imaf_cb);
|
||||
if (option_set_callback_func(p_imaf, &imaf_cb) == FAIL)
|
||||
return e_invalid_argument;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
char *
|
||||
set_imstatusfunc_option(void)
|
||||
{
|
||||
return option_set_callback_func(p_imsf, &imsf_cb);
|
||||
if (option_set_callback_func(p_imsf, &imsf_cb) == FAIL)
|
||||
return e_invalid_argument;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -2545,16 +2545,15 @@ copy_global_to_buflocal_cb(callback_T *globcb, callback_T *bufcb)
|
||||
* name of a function (string), or function(<name>) or funcref(<name>) or a
|
||||
* lambda expression.
|
||||
*/
|
||||
int
|
||||
char *
|
||||
set_completefunc_option(void)
|
||||
{
|
||||
int retval;
|
||||
if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL)
|
||||
return e_invalid_argument;
|
||||
|
||||
retval = option_set_callback_func(curbuf->b_p_cfu, &cfu_cb);
|
||||
if (retval == OK)
|
||||
set_buflocal_cfu_callback(curbuf);
|
||||
set_buflocal_cfu_callback(curbuf);
|
||||
|
||||
return retval;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2575,16 +2574,14 @@ set_buflocal_cfu_callback(buf_T *buf UNUSED)
|
||||
* name of a function (string), or function(<name>) or funcref(<name>) or a
|
||||
* lambda expression.
|
||||
*/
|
||||
int
|
||||
char *
|
||||
set_omnifunc_option(void)
|
||||
{
|
||||
int retval;
|
||||
if (option_set_callback_func(curbuf->b_p_ofu, &ofu_cb) == FAIL)
|
||||
return e_invalid_argument;
|
||||
|
||||
retval = option_set_callback_func(curbuf->b_p_ofu, &ofu_cb);
|
||||
if (retval == OK)
|
||||
set_buflocal_ofu_callback(curbuf);
|
||||
|
||||
return retval;
|
||||
set_buflocal_ofu_callback(curbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2605,7 +2602,7 @@ set_buflocal_ofu_callback(buf_T *buf UNUSED)
|
||||
* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3405,10 +3405,13 @@ static callback_T opfunc_cb;
|
||||
* Process the 'operatorfunc' option value.
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
int
|
||||
char *
|
||||
set_operatorfunc_option(void)
|
||||
{
|
||||
return option_set_callback_func(p_opfunc, &opfunc_cb);
|
||||
if (option_set_callback_func(p_opfunc, &opfunc_cb) == FAIL)
|
||||
return e_invalid_argument;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(EXITFREE) || defined(PROTO)
|
||||
|
3264
src/optionstr.c
3264
src/optionstr.c
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
/* gui_xim.c */
|
||||
int set_imactivatefunc_option(void);
|
||||
int set_imstatusfunc_option(void);
|
||||
char *set_imactivatefunc_option(void);
|
||||
char *set_imstatusfunc_option(void);
|
||||
void free_xim_stuff(void);
|
||||
int set_ref_in_im_funcs(int copyID);
|
||||
void im_set_active(int active);
|
||||
|
@ -44,11 +44,11 @@ int ins_compl_bs(void);
|
||||
void ins_compl_addleader(int c);
|
||||
void ins_compl_addfrommatch(void);
|
||||
int ins_compl_prep(int c);
|
||||
int set_completefunc_option(void);
|
||||
char *set_completefunc_option(void);
|
||||
void set_buflocal_cfu_callback(buf_T *buf);
|
||||
int set_omnifunc_option(void);
|
||||
char *set_omnifunc_option(void);
|
||||
void set_buflocal_ofu_callback(buf_T *buf);
|
||||
int set_thesaurusfunc_option(void);
|
||||
char *set_thesaurusfunc_option(void);
|
||||
int set_ref_in_insexpand_funcs(int copyID);
|
||||
void f_complete(typval_T *argvars, typval_T *rettv);
|
||||
void f_complete_add(typval_T *argvars, typval_T *rettv);
|
||||
|
@ -17,7 +17,7 @@ void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int is_del);
|
||||
void op_addsub(oparg_T *oap, linenr_T Prenum1, int g_cmd);
|
||||
void clear_oparg(oparg_T *oap);
|
||||
void cursor_pos_info(dict_T *dict);
|
||||
int set_operatorfunc_option(void);
|
||||
char *set_operatorfunc_option(void);
|
||||
void free_operatorfunc_option(void);
|
||||
int set_ref_in_opfunc(int copyID);
|
||||
void do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank);
|
||||
|
@ -15,7 +15,7 @@ void ex_cclose(exarg_T *eap);
|
||||
void ex_copen(exarg_T *eap);
|
||||
void ex_cbottom(exarg_T *eap);
|
||||
linenr_T qf_current_entry(win_T *wp);
|
||||
int qf_process_qftf_option(void);
|
||||
char *qf_process_qftf_option(void);
|
||||
int grep_internal(cmdidx_T cmdidx);
|
||||
void ex_make(exarg_T *eap);
|
||||
int qf_get_size(exarg_T *eap);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* tag.c */
|
||||
int set_tagfunc_option(void);
|
||||
char *set_tagfunc_option(void);
|
||||
void free_tagfunc_option(void);
|
||||
int set_ref_in_tagfunc(int copyID);
|
||||
void set_buflocal_tfu_callback(buf_T *buf);
|
||||
|
@ -4533,10 +4533,13 @@ qf_find_buf(qf_info_T *qi)
|
||||
* Process the 'quickfixtextfunc' option value.
|
||||
* Returns OK or FAIL.
|
||||
*/
|
||||
int
|
||||
char *
|
||||
qf_process_qftf_option(void)
|
||||
{
|
||||
return option_set_callback_func(p_qftf, &qftf_cb);
|
||||
if (option_set_callback_func(p_qftf, &qftf_cb) == FAIL)
|
||||
return e_invalid_argument;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4386,7 +4386,7 @@ valid_spellfile(char_u *val)
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle side effects of setting 'spell'.
|
||||
* Handle side effects of setting 'spell' or 'spellfile'
|
||||
* Return an error message or NULL for success.
|
||||
*/
|
||||
char *
|
||||
|
@ -170,7 +170,7 @@ static callback_T tfu_cb; // 'tagfunc' callback function
|
||||
* 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
|
||||
char *
|
||||
set_tagfunc_option(void)
|
||||
{
|
||||
#ifdef FEAT_EVAL
|
||||
@ -178,15 +178,15 @@ set_tagfunc_option(void)
|
||||
free_callback(&curbuf->b_tfu_cb);
|
||||
|
||||
if (*curbuf->b_p_tfu == NUL)
|
||||
return OK;
|
||||
return NULL;
|
||||
|
||||
if (option_set_callback_func(curbuf->b_p_tfu, &tfu_cb) == FAIL)
|
||||
return FAIL;
|
||||
return e_invalid_argument;
|
||||
|
||||
copy_callback(&curbuf->b_tfu_cb, &tfu_cb);
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1262,
|
||||
/**/
|
||||
1261,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user