diff options
| author | ii14 <59243201+ii14@users.noreply.github.com> | 2023-04-05 21:13:53 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-05 21:13:53 +0200 |
| commit | 371823d407d7d7519735131bcad4670c62a731a7 (patch) | |
| tree | b303ffd5d01f6bcb447b0c783de294dd3bac4914 /src/nvim/eval | |
| parent | 2612930a092736a2f507e06475634346582f8ae1 (diff) | |
| download | rneovim-371823d407d7d7519735131bcad4670c62a731a7.tar.gz rneovim-371823d407d7d7519735131bcad4670c62a731a7.tar.bz2 rneovim-371823d407d7d7519735131bcad4670c62a731a7.zip | |
refactor: make error message definitions const
message.c functions now take const char * as a format. Error message
definitions can be made const.
Diffstat (limited to 'src/nvim/eval')
| -rw-r--r-- | src/nvim/eval/funcs.c | 10 | ||||
| -rw-r--r-- | src/nvim/eval/typval.c | 22 | ||||
| -rw-r--r-- | src/nvim/eval/userfunc.c | 16 | ||||
| -rw-r--r-- | src/nvim/eval/vars.c | 6 | ||||
| -rw-r--r-- | src/nvim/eval/window.c | 4 |
5 files changed, 29 insertions, 29 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 4286e16eb1..4225e164e4 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -145,10 +145,10 @@ PRAGMA_DIAG_POP PRAGMA_DIAG_POP #endif -static char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob"); -static char *e_invalwindow = N_("E957: Invalid window number"); -static char *e_reduceempty = N_("E998: Reduce of an empty %s with no initial value"); -static char e_using_number_as_bool_nr[] +static const char *e_listblobarg = N_("E899: Argument of %s must be a List or Blob"); +static const char *e_invalwindow = N_("E957: Invalid window number"); +static const char *e_reduceempty = N_("E998: Reduce of an empty %s with no initial value"); +static const char e_using_number_as_bool_nr[] = N_("E1023: Using a Number as a Bool: %d"); /// Dummy va_list for passing to vim_snprintf @@ -7557,7 +7557,7 @@ free_lstval: /// "settagstack()" function static void f_settagstack(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) { - static char *e_invact2 = N_("E962: Invalid action: '%s'"); + static const char *e_invact2 = N_("E962: Invalid action: '%s'"); char action = 'r'; rettv->vval.v_number = -1; diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c index d077998dae..8e5db64d6a 100644 --- a/src/nvim/eval/typval.c +++ b/src/nvim/eval/typval.c @@ -40,25 +40,25 @@ # include "eval/typval.c.generated.h" #endif -static char e_string_required_for_argument_nr[] +static const char e_string_required_for_argument_nr[] = N_("E1174: String required for argument %d"); -static char e_non_empty_string_required_for_argument_nr[] +static const char e_non_empty_string_required_for_argument_nr[] = N_("E1175: Non-empty string required for argument %d"); -static char e_dict_required_for_argument_nr[] +static const char e_dict_required_for_argument_nr[] = N_("E1206: Dictionary required for argument %d"); -static char e_number_required_for_argument_nr[] +static const char e_number_required_for_argument_nr[] = N_("E1210: Number required for argument %d"); -static char e_list_required_for_argument_nr[] +static const char e_list_required_for_argument_nr[] = N_("E1211: List required for argument %d"); -static char e_string_or_list_required_for_argument_nr[] +static const char e_string_or_list_required_for_argument_nr[] = N_("E1222: String or List required for argument %d"); -static char e_list_or_blob_required_for_argument_nr[] +static const char e_list_or_blob_required_for_argument_nr[] = N_("E1226: List or Blob required for argument %d"); -static char e_blob_required_for_argument_nr[] +static const char e_blob_required_for_argument_nr[] = N_("E1238: Blob required for argument %d"); -static char e_invalid_value_for_blob_nr[] +static const char e_invalid_value_for_blob_nr[] = N_("E1239: Invalid value for blob: %d"); -static char e_string_or_function_required_for_argument_nr[] +static const char e_string_or_function_required_for_argument_nr[] = N_("E1256: String or function required for argument %d"); bool tv_in_free_unref_items = false; @@ -2868,7 +2868,7 @@ void f_list2blob(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) varnumber_T n = tv_get_number_chk(TV_LIST_ITEM_TV(li), &error); if (error || n < 0 || n > 255) { if (!error) { - semsg(_(e_invalid_value_for_blob_nr), n); + semsg(_(e_invalid_value_for_blob_nr), (int)n); } ga_clear(&blob->bv_ga); return; diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 40bca9acc1..9f5d964075 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -65,11 +65,11 @@ static funccall_T *current_funccal = NULL; // item in it is still being used. static funccall_T *previous_funccal = NULL; -static char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it"); -static char *e_funcdict = N_("E717: Dictionary entry already exists"); -static char *e_funcref = N_("E718: Funcref required"); -static char *e_nofunc = N_("E130: Unknown function: %s"); -static char e_no_white_space_allowed_before_str_str[] +static const char *e_funcexts = N_("E122: Function %s already exists, add ! to replace it"); +static const char *e_funcdict = N_("E717: Dictionary entry already exists"); +static const char *e_funcref = N_("E718: Funcref required"); +static const char *e_nofunc = N_("E130: Unknown function: %s"); +static const char e_no_white_space_allowed_before_str_str[] = N_("E1068: No white space allowed before '%s': %s"); void func_init(void) @@ -421,9 +421,9 @@ char *deref_func_name(const char *name, int *lenp, partial_T **const partialp, b /// Give an error message with a function name. Handle <SNR> things. /// -/// @param ermsg must be passed without translation (use N_() instead of _()). +/// @param errmsg must be passed without translation (use N_() instead of _()). /// @param name function name -void emsg_funcname(char *ermsg, const char *name) +void emsg_funcname(const char *errmsg, const char *name) { char *p; @@ -433,7 +433,7 @@ void emsg_funcname(char *ermsg, const char *name) p = (char *)name; } - semsg(_(ermsg), p); + semsg(_(errmsg), p); if (p != name) { xfree(p); diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index ed2453bd59..6252adf6a1 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -50,8 +50,8 @@ #define DICT_MAXNEST 100 // maximum nesting of lists and dicts -static char *e_letunexp = N_("E18: Unexpected characters in :let"); -static char *e_lock_unlock = N_("E940: Cannot lock or unlock variable %s"); +static const char *e_letunexp = N_("E18: Unexpected characters in :let"); +static const char *e_lock_unlock = N_("E940: Cannot lock or unlock variable %s"); /// Get a list of lines from a HERE document. The here document is a list of /// lines surrounded by a marker. @@ -693,7 +693,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo if (!failed) { if (opt_type != gov_string || s != NULL) { - char *err = set_option_value(arg, (long)n, s, scope); + const char *err = set_option_value(arg, (long)n, s, scope); arg_end = p; if (err != NULL) { emsg(_(err)); diff --git a/src/nvim/eval/window.c b/src/nvim/eval/window.c index c1d2e5b38f..cf5727fa59 100644 --- a/src/nvim/eval/window.c +++ b/src/nvim/eval/window.c @@ -36,8 +36,8 @@ # include "eval/window.c.generated.h" #endif -static char *e_invalwindow = N_("E957: Invalid window number"); -static char e_cannot_resize_window_in_another_tab_page[] +static const char *e_invalwindow = N_("E957: Invalid window number"); +static const char e_cannot_resize_window_in_another_tab_page[] = N_("E1308: Cannot resize a window in another tab page"); static int win_getid(typval_T *argvars) |