1
0
forked from aniani/vim

patch 8.2.4727: unused code

Problem:    Unused code.
Solution:   Remove code and add #ifdefs. (Dominique Pellé, closes #10136)
This commit is contained in:
Dominique Pelle
2022-04-10 11:26:53 +01:00
committed by Bram Moolenaar
parent 6013d0045d
commit 7765f5cf96
8 changed files with 38 additions and 46 deletions

View File

@@ -1224,7 +1224,7 @@ Examples: >
If you want to always use ":confirm", set the 'confirm' option. If you want to always use ":confirm", set the 'confirm' option.
*:browse* *:bro* *E338* *E614* *E615* *E616* *:browse* *:bro* *E338*
:bro[wse] {command} Open a file selection dialog for an argument to :bro[wse] {command} Open a file selection dialog for an argument to
{command}. At present this works for |:e|, |:w|, {command}. At present this works for |:e|, |:w|,
|:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|, |:wall|, |:wq|, |:wqall|, |:x|, |:xall|, |:exit|,

View File

@@ -181,7 +181,7 @@ You will not get an error if you try to change the type of a variable.
1.2 Function references ~ 1.2 Function references ~
*Funcref* *E695* *E718* *E1086* *E1192* *Funcref* *E695* *E718* *E1192*
A Funcref variable is obtained with the |function()| function, the |funcref()| A Funcref variable is obtained with the |function()| function, the |funcref()|
function or created with the lambda expression |expr-lambda|. It can be used function or created with the lambda expression |expr-lambda|. It can be used
in an expression in the place of a function name, before the parenthesis in an expression in the place of a function name, before the parenthesis

View File

@@ -378,7 +378,7 @@ And with autocommands: >
Although using a :def function probably works better. Although using a :def function probably works better.
*E1022* *E1103* *E1130* *E1131* *E1133* *E1022* *E1103* *E1130* *E1131* *E1133*
*E1134* *E1235* *E1134*
Declaring a variable with a type but without an initializer will initialize to Declaring a variable with a type but without an initializer will initialize to
false (for bool), empty (for string, list, dict, etc.) or zero (for number, false (for bool), empty (for string, list, dict, etc.) or zero (for number,
any, etc.). This matters especially when using the "any" type, the value will any, etc.). This matters especially when using the "any" type, the value will

View File

@@ -1152,8 +1152,10 @@ EXTERN char e_region_is_guarded_cannot_modify[]
#endif #endif
EXTERN char e_ambiguous_use_of_user_defined_command[] EXTERN char e_ambiguous_use_of_user_defined_command[]
INIT(= N_("E464: Ambiguous use of user-defined command")); INIT(= N_("E464: Ambiguous use of user-defined command"));
#ifdef FEAT_EVAL
EXTERN char e_ambiguous_use_of_user_defined_command_str[] EXTERN char e_ambiguous_use_of_user_defined_command_str[]
INIT(= N_("E464: Ambiguous use of user-defined command: %s")); INIT(= N_("E464: Ambiguous use of user-defined command: %s"));
#endif
EXTERN char e_winsize_requires_two_number_arguments[] EXTERN char e_winsize_requires_two_number_arguments[]
INIT(= N_("E465: :winsize requires two number arguments")); INIT(= N_("E465: :winsize requires two number arguments"));
EXTERN char e_winpos_requires_two_number_arguments[] EXTERN char e_winpos_requires_two_number_arguments[]
@@ -1554,14 +1556,9 @@ EXTERN char e_too_many_signs_defined[]
EXTERN char e_unknown_printer_font_str[] EXTERN char e_unknown_printer_font_str[]
INIT(= N_("E613: Unknown printer font: %s")); INIT(= N_("E613: Unknown printer font: %s"));
#endif #endif
#ifdef FEAT_BROWSE // E614 unused
EXTERN char e_vim_selfile_cant_return_to_current_directory[] // E615 unused
INIT(= N_("E614: vim_SelFile: can't return to current directory")); // E616 unused
EXTERN char e_vim_selfile_cant_get_current_directory[]
INIT(= N_("E615: vim_SelFile: can't get current directory"));
EXTERN char e_vim_selfile_cant_get_font_str[]
INIT(= N_("E616: vim_SelFile: can't get font %s"));
#endif
#ifdef FEAT_GUI_GTK #ifdef FEAT_GUI_GTK
EXTERN char e_cannot_be_changed_in_gtk_GUI[] EXTERN char e_cannot_be_changed_in_gtk_GUI[]
INIT(= N_("E617: Cannot be changed in the GTK GUI")); INIT(= N_("E617: Cannot be changed in the GTK GUI"));
@@ -2809,8 +2806,7 @@ EXTERN char e_cannot_delete_vim9_script_function_str[]
INIT(= N_("E1084: Cannot delete Vim9 script function %s")); INIT(= N_("E1084: Cannot delete Vim9 script function %s"));
EXTERN char e_not_callable_type_str[] EXTERN char e_not_callable_type_str[]
INIT(= N_("E1085: Not a callable type: %s")); INIT(= N_("E1085: Not a callable type: %s"));
EXTERN char e_function_reference_invalid[] // E1086 unused
INIT(= N_("E1086: Function reference invalid"));
EXTERN char e_cannot_use_index_when_declaring_variable[] EXTERN char e_cannot_use_index_when_declaring_variable[]
INIT(= N_("E1087: Cannot use an index when declaring a variable")); INIT(= N_("E1087: Cannot use an index when declaring a variable"));
EXTERN char e_script_cannot_import_itself[] EXTERN char e_script_cannot_import_itself[]
@@ -3115,16 +3111,20 @@ EXTERN char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
INIT(= N_("E1216: digraph_setlist() argument must be a list of lists with two items")); INIT(= N_("E1216: digraph_setlist() argument must be a list of lists with two items"));
#endif #endif
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
# ifdef FEAT_JOB_CHANNEL
EXTERN char e_chan_or_job_required_for_argument_nr[] EXTERN char e_chan_or_job_required_for_argument_nr[]
INIT(= N_("E1217: Channel or Job required for argument %d")); INIT(= N_("E1217: Channel or Job required for argument %d"));
EXTERN char e_job_required_for_argument_nr[] EXTERN char e_job_required_for_argument_nr[]
INIT(= N_("E1218: Job required for argument %d")); INIT(= N_("E1218: Job required for argument %d"));
# endif
EXTERN char e_float_or_number_required_for_argument_nr[] EXTERN char e_float_or_number_required_for_argument_nr[]
INIT(= N_("E1219: Float or Number required for argument %d")); INIT(= N_("E1219: Float or Number required for argument %d"));
EXTERN char e_string_or_number_required_for_argument_nr[] EXTERN char e_string_or_number_required_for_argument_nr[]
INIT(= N_("E1220: String or Number required for argument %d")); INIT(= N_("E1220: String or Number required for argument %d"));
# ifdef FEAT_JOB_CHANNEL
EXTERN char e_string_or_blob_required_for_argument_nr[] EXTERN char e_string_or_blob_required_for_argument_nr[]
INIT(= N_("E1221: String or Blob required for argument %d")); INIT(= N_("E1221: String or Blob required for argument %d"));
# endif
EXTERN char e_string_or_list_required_for_argument_nr[] EXTERN char e_string_or_list_required_for_argument_nr[]
INIT(= N_("E1222: String or List required for argument %d")); INIT(= N_("E1222: String or List required for argument %d"));
EXTERN char e_string_or_dict_required_for_argument_nr[] EXTERN char e_string_or_dict_required_for_argument_nr[]
@@ -3157,8 +3157,7 @@ EXTERN char e_exists_compiled_can_only_be_used_in_def_function[]
EXTERN char e_legacy_must_be_followed_by_command[] EXTERN char e_legacy_must_be_followed_by_command[]
INIT(= N_("E1234: legacy must be followed by a command")); INIT(= N_("E1234: legacy must be followed by a command"));
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
EXTERN char e_function_reference_is_not_set[] // E1235 unused
INIT(= N_("E1235: Function reference is not set"));
EXTERN char e_cannot_use_str_itself_it_is_imported[] EXTERN char e_cannot_use_str_itself_it_is_imported[]
INIT(= N_("E1236: Cannot use %s itself, it is imported")); INIT(= N_("E1236: Cannot use %s itself, it is imported"));
#endif #endif

View File

@@ -4463,6 +4463,7 @@ get_encoding_default(void)
return (char_u *)NULL; return (char_u *)NULL;
} }
#if defined(FEAT_QUICKFIX) || defined(PROTO)
int int
is_option_allocated(char *name) is_option_allocated(char *name)
{ {
@@ -4470,6 +4471,7 @@ is_option_allocated(char *name)
return idx >= 0 && (options[idx].flags & P_ALLOCED); return idx >= 0 && (options[idx].flags & P_ALLOCED);
} }
#endif
/* /*
* Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number. * Translate a string like "t_xx", "<t_xx>" or "<S-Tab>" to a key number.
@@ -7179,6 +7181,7 @@ get_bkc_value(buf_T *buf)
return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags; return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
} }
#if defined(FEAT_LINEBREAK) || defined(PROTO)
/* /*
* Get the local or global value of 'formatlistpat'. * Get the local or global value of 'formatlistpat'.
*/ */
@@ -7189,6 +7192,7 @@ get_flp_value(buf_T *buf)
return p_flp; return p_flp;
return buf->b_p_flp; return buf->b_p_flp;
} }
#endif
/* /*
* Get the local or global value of the 'virtualedit' flags. * Get the local or global value of the 'virtualedit' flags.

View File

@@ -42,5 +42,4 @@ void f_matchfuzzy(typval_T *argvars, typval_T *rettv);
void f_matchfuzzypos(typval_T *argvars, typval_T *rettv); void f_matchfuzzypos(typval_T *argvars, typval_T *rettv);
int fuzzy_match_str(char_u *str, char_u *pat); int fuzzy_match_str(char_u *str, char_u *pat);
int fuzzymatches_to_strmatches(fuzmatch_str_T *fuzmatch, char_u ***matches, int count, int funcsort); int fuzzymatches_to_strmatches(fuzmatch_str_T *fuzmatch, char_u ***matches, int count, int funcsort);
void fuzmatch_str_free(fuzmatch_str_T *fuzmatch, int count);
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -1377,8 +1377,8 @@ do_search(
*/ */
if (*p == '+' || *p == '-' || VIM_ISDIGIT(*p)) if (*p == '+' || *p == '-' || VIM_ISDIGIT(*p))
spats[0].off.line = TRUE; spats[0].off.line = TRUE;
else if ((options & SEARCH_OPT) && else if ((options & SEARCH_OPT)
(*p == 'e' || *p == 's' || *p == 'b')) && (*p == 'e' || *p == 's' || *p == 'b'))
{ {
if (*p == 'e') // end if (*p == 'e') // end
spats[0].off.end = SEARCH_END; spats[0].off.end = SEARCH_END;
@@ -1404,9 +1404,9 @@ do_search(
pat = p; // put pat after search command pat = p; // put pat after search command
} }
if ((options & SEARCH_ECHO) && messaging() && if ((options & SEARCH_ECHO) && messaging()
!msg_silent && && !msg_silent
(!cmd_silent || !shortmess(SHM_SEARCHCOUNT))) && (!cmd_silent || !shortmess(SHM_SEARCHCOUNT)))
{ {
char_u *trunc; char_u *trunc;
char_u off_buf[40]; char_u off_buf[40];
@@ -2450,8 +2450,8 @@ findmatchlimit(
/* /*
* If FM_BLOCKSTOP given, stop at a '{' or '}' in column 0. * If FM_BLOCKSTOP given, stop at a '{' or '}' in column 0.
*/ */
if (pos.col == 0 && (flags & FM_BLOCKSTOP) && if (pos.col == 0 && (flags & FM_BLOCKSTOP)
(linep[0] == '{' || linep[0] == '}')) && (linep[0] == '{' || linep[0] == '}'))
{ {
if (linep[0] == findc && count == 0) // match! if (linep[0] == findc && count == 0) // match!
return &pos; return &pos;
@@ -2653,8 +2653,8 @@ findmatchlimit(
pos.col -= 2; pos.col -= 2;
break; break;
} }
else if (linep[pos.col - 2] == '\\' && else if (linep[pos.col - 2] == '\\'
pos.col > 2 && linep[pos.col - 3] == '\'') && pos.col > 2 && linep[pos.col - 3] == '\'')
{ {
pos.col -= 3; pos.col -= 3;
break; break;
@@ -2663,8 +2663,8 @@ findmatchlimit(
} }
else if (linep[pos.col + 1]) // forward search else if (linep[pos.col + 1]) // forward search
{ {
if (linep[pos.col + 1] == '\\' && if (linep[pos.col + 1] == '\\'
linep[pos.col + 2] && linep[pos.col + 3] == '\'') && linep[pos.col + 2] && linep[pos.col + 3] == '\'')
{ {
pos.col += 3; pos.col += 3;
break; break;
@@ -3471,8 +3471,9 @@ find_pattern_in_path(
if (fullpathcmp(new_fname, files[i].name, TRUE, TRUE) if (fullpathcmp(new_fname, files[i].name, TRUE, TRUE)
& FPC_SAME) & FPC_SAME)
{ {
if (type != CHECK_PATH && if (type != CHECK_PATH
action == ACTION_SHOW_ALL && files[i].matched) && action == ACTION_SHOW_ALL
&& files[i].matched)
{ {
msg_putchar('\n'); // cursor below last one msg_putchar('\n'); // cursor below last one
if (!got_int) // don't display if 'q' if (!got_int) // don't display if 'q'
@@ -4678,8 +4679,8 @@ fuzzy_match_in_list(
rettv.v_type = VAR_UNKNOWN; rettv.v_type = VAR_UNKNOWN;
if (li->li_tv.v_type == VAR_STRING) // list of strings if (li->li_tv.v_type == VAR_STRING) // list of strings
itemstr = li->li_tv.vval.v_string; itemstr = li->li_tv.vval.v_string;
else if (li->li_tv.v_type == VAR_DICT && else if (li->li_tv.v_type == VAR_DICT
(key != NULL || item_cb->cb_name != NULL)) && (key != NULL || item_cb->cb_name != NULL))
{ {
// For a dict, either use the specified key to lookup the string or // For a dict, either use the specified key to lookup the string or
// use the specified callback function to get the string. // use the specified callback function to get the string.
@@ -4786,8 +4787,8 @@ fuzzy_match_in_list(
{ {
if (ptrs[i].score == SCORE_NONE) if (ptrs[i].score == SCORE_NONE)
break; break;
if (ptrs[i].lmatchpos != NULL && if (ptrs[i].lmatchpos != NULL
list_append_list(l, ptrs[i].lmatchpos) == FAIL) && list_append_list(l, ptrs[i].lmatchpos) == FAIL)
goto done; goto done;
} }
@@ -5050,16 +5051,3 @@ fuzzymatches_to_strmatches(
return OK; return OK;
} }
/*
* Free a list of fuzzy string matches.
*/
void
fuzmatch_str_free(fuzmatch_str_T *fuzmatch, int count)
{
if (count <= 0 || fuzmatch == NULL)
return;
while (count--)
vim_free(fuzmatch[count].str);
vim_free(fuzmatch);
}

View File

@@ -746,6 +746,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
4727,
/**/ /**/
4726, 4726,
/**/ /**/