aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/api/options.c2
-rw-r--r--src/nvim/arglist.c2
-rw-r--r--src/nvim/buffer.c4
-rw-r--r--src/nvim/digraph.c6
-rw-r--r--src/nvim/eval.c16
-rw-r--r--src/nvim/eval/funcs.c10
-rw-r--r--src/nvim/eval/typval.c22
-rw-r--r--src/nvim/eval/userfunc.c16
-rw-r--r--src/nvim/eval/vars.c6
-rw-r--r--src/nvim/eval/window.c4
-rw-r--r--src/nvim/ex_docmd.c10
-rw-r--r--src/nvim/ex_eval.c2
-rw-r--r--src/nvim/ex_getln.c4
-rw-r--r--src/nvim/file_search.c2
-rw-r--r--src/nvim/fileio.c4
-rw-r--r--src/nvim/fold.c2
-rw-r--r--src/nvim/gettext.h4
-rw-r--r--src/nvim/globals.h302
-rw-r--r--src/nvim/insexpand.c10
-rw-r--r--src/nvim/match.c2
-rw-r--r--src/nvim/mbyte.c12
-rw-r--r--src/nvim/menu.c4
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c2
-rw-r--r--src/nvim/option.c44
-rw-r--r--src/nvim/optionstr.c152
-rw-r--r--src/nvim/quickfix.c12
-rw-r--r--src/nvim/regexp.c30
-rw-r--r--src/nvim/regexp_nfa.c14
-rw-r--r--src/nvim/spell.c6
-rw-r--r--src/nvim/spellfile.c10
-rw-r--r--src/nvim/syntax.c2
-rw-r--r--src/nvim/tag.c12
-rw-r--r--src/nvim/testing.c10
-rw-r--r--src/nvim/undo.c2
-rw-r--r--src/nvim/usercmd.c6
-rw-r--r--src/nvim/window.c4
37 files changed, 379 insertions, 375 deletions
diff --git a/src/nvim/api/options.c b/src/nvim/api/options.c
index baeb3e88fb..3e7f7e8781 100644
--- a/src/nvim/api/options.c
+++ b/src/nvim/api/options.c
@@ -559,7 +559,7 @@ static getoption_T access_option_value(char *key, long *numval, char **stringval
if (get) {
return get_option_value(key, numval, stringval, NULL, opt_flags);
} else {
- char *errmsg;
+ const char *errmsg;
if ((errmsg = set_option_value(key, *numval, *stringval, opt_flags))) {
if (try_end(err)) {
return 0;
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 3882b98c2c..537b56353e 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -63,7 +63,7 @@ typedef struct {
# include "arglist.c.generated.h"
#endif
-static char e_cannot_change_arglist_recursively[]
+static const char e_cannot_change_arglist_recursively[]
= N_("E1156: Cannot change the argument list recursively");
enum {
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index cedbadbaf3..fb674774c6 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -106,8 +106,8 @@
# include "buffer.c.generated.h"
#endif
-static char *e_auabort = N_("E855: Autocommands caused command to abort");
-static char e_attempt_to_delete_buffer_that_is_in_use_str[]
+static const char *e_auabort = N_("E855: Autocommands caused command to abort");
+static const char e_attempt_to_delete_buffer_that_is_in_use_str[]
= N_("E937: Attempt to delete a buffer that is in use: %s");
// Number of times free_buffer() was called.
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 2066151564..7d6349e552 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -47,11 +47,11 @@ typedef struct digraph {
result_T result;
} digr_T;
-static char e_digraph_must_be_just_two_characters_str[]
+static const char e_digraph_must_be_just_two_characters_str[]
= N_("E1214: Digraph must be just two characters: %s");
-static char e_digraph_argument_must_be_one_character_str[]
+static const char e_digraph_argument_must_be_one_character_str[]
= N_("E1215: Digraph must be one character: %s");
-static char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
+static const char e_digraph_setlist_argument_must_be_list_of_lists_with_two_items[]
= N_("E1216: digraph_setlist() argument must be a list of lists with two items");
#ifdef INCLUDE_GENERATED_DECLARATIONS
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index edaa2bb809..16a2dfa39b 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -86,15 +86,15 @@
#define DICT_MAXNEST 100 // maximum nesting of lists and dicts
-static char *e_missbrac = N_("E111: Missing ']'");
-static char *e_list_end = N_("E697: Missing end of List ']': %s");
-static char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
-static char *e_nowhitespace
+static const char *e_missbrac = N_("E111: Missing ']'");
+static const char *e_list_end = N_("E697: Missing end of List ']': %s");
+static const char *e_dictrange = N_("E719: Cannot use [:] with a Dictionary");
+static const char *e_nowhitespace
= N_("E274: No white space allowed before parenthesis");
-static char *e_write2 = N_("E80: Error while writing: %s");
-static char *e_string_list_or_blob_required = N_("E1098: String, List or Blob required");
-static char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s");
-static char e_dot_can_only_be_used_on_dictionary_str[]
+static const char *e_write2 = N_("E80: Error while writing: %s");
+static const char *e_string_list_or_blob_required = N_("E1098: String, List or Blob required");
+static const char e_expression_too_recursive_str[] = N_("E1169: Expression too recursive: %s");
+static const char e_dot_can_only_be_used_on_dictionary_str[]
= N_("E1203: Dot can only be used on a dictionary: %s");
static char * const namespace_char = "abglstvw";
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)
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 6a259b75fb..bc8c7eead0 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -85,15 +85,15 @@
#include "nvim/vim.h"
#include "nvim/window.h"
-static char e_ambiguous_use_of_user_defined_command[]
+static const char e_ambiguous_use_of_user_defined_command[]
= N_("E464: Ambiguous use of user-defined command");
-static char e_not_an_editor_command[]
+static const char e_not_an_editor_command[]
= N_("E492: Not an editor command");
-static char e_no_source_file_name_to_substitute_for_sfile[]
+static const char e_no_source_file_name_to_substitute_for_sfile[]
= N_("E498: no :source file name to substitute for \"<sfile>\"");
-static char e_no_call_stack_to_substitute_for_stack[]
+static const char e_no_call_stack_to_substitute_for_stack[]
= N_("E489: no call stack to substitute for \"<stack>\"");
-static char e_no_script_file_name_to_substitute_for_script[]
+static const char e_no_script_file_name_to_substitute_for_script[]
= N_("E1274: No script file name to substitute for \"<script>\"");
static int quitmore = 0;
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index 1cef99297a..6fdd150571 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -1055,7 +1055,7 @@ void ex_break(exarg_T *eap)
void ex_endwhile(exarg_T *eap)
{
cstack_T *const cstack = eap->cstack;
- char *err;
+ const char *err;
int csf;
if (eap->cmdidx == CMD_endwhile) {
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index bd7ddbf567..cdbb41c8ae 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -2753,7 +2753,7 @@ void text_locked_msg(void)
emsg(_(get_text_locked_msg()));
}
-char *get_text_locked_msg(void)
+const char *get_text_locked_msg(void)
{
if (cmdwin_type != 0) {
return e_cmdwin;
@@ -4274,7 +4274,7 @@ void cmdline_init(void)
/// Check value of 'cedit' and set cedit_key.
/// Returns NULL if value is OK, error message otherwise.
-char *check_cedit(void)
+const char *check_cedit(void)
{
if (*p_cedit == NUL) {
cedit_key = -1;
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index d91e2dfeeb..d341cb20c4 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -182,7 +182,7 @@ typedef struct ff_search_ctx_T {
# include "file_search.c.generated.h"
#endif
-static char e_pathtoolong[] = N_("E854: path too long for completion");
+static const char e_pathtoolong[] = N_("E854: path too long for completion");
/// Initialization routine for vim_findfile().
///
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 684658b4e3..cbb378b4b6 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -134,8 +134,8 @@ static char *err_readonly = "is read-only (cannot override: \"W\" in 'cpoptions'
# include "fileio.c.generated.h"
#endif
-static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
-static char e_no_matching_autocommands_for_buftype_str_buffer[]
+static const char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
+static const char e_no_matching_autocommands_for_buftype_str_buffer[]
= N_("E676: No matching autocommands for buftype=%s buffer");
void filemess(buf_T *buf, char *name, char *s, int attr)
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 7306131574..2b33f00c67 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -101,7 +101,7 @@ typedef void (*LevelGetter)(fline_T *);
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "fold.c.generated.h"
#endif
-static char *e_nofold = N_("E490: No fold found");
+static const char *e_nofold = N_("E490: No fold found");
// While updating the folds lines between invalid_top and invalid_bot have an
// undefined fold level. Only used for the window currently being updated.
diff --git a/src/nvim/gettext.h b/src/nvim/gettext.h
index 6d2a55124e..9d7b2aec32 100644
--- a/src/nvim/gettext.h
+++ b/src/nvim/gettext.h
@@ -3,7 +3,7 @@
#ifdef HAVE_WORKING_LIBINTL
# include <libintl.h>
-# define _(x) gettext((char *)(x))
+# define _(x) gettext(x)
// XXX do we actually need this?
# ifdef gettext_noop
# define N_(x) gettext_noop(x)
@@ -17,7 +17,7 @@
# undef setlocale
# endif
#else
-# define _(x) ((char *)(x))
+# define _(x) (x)
# define N_(x) x
# define NGETTEXT(x, xs, n) ((n) == 1 ? (x) : (xs))
# define bindtextdomain(x, y) // empty
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 571df45e89..7653076e39 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -866,172 +866,172 @@ EXTERN linenr_T spell_redraw_lnum INIT(= 0);
// The error messages that can be shared are included here.
// Excluded are errors that are only used once and debugging messages.
-EXTERN char e_abort[] INIT(= N_("E470: Command aborted"));
-EXTERN char e_afterinit[] INIT(= N_("E905: Cannot set this option after startup"));
-EXTERN char e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job"));
-EXTERN char e_argreq[] INIT(= N_("E471: Argument required"));
-EXTERN char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
-EXTERN char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
-EXTERN char e_curdir[] INIT(= N_("E12: Command not allowed in secure mode in current dir or tag search"));
-EXTERN char e_command_too_recursive[] INIT(= N_("E169: Command too recursive"));
-EXTERN char e_endif[] INIT(= N_("E171: Missing :endif"));
-EXTERN char e_endtry[] INIT(= N_("E600: Missing :endtry"));
-EXTERN char e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
-EXTERN char e_endfor[] INIT(= N_("E170: Missing :endfor"));
-EXTERN char e_while[] INIT(= N_("E588: :endwhile without :while"));
-EXTERN char e_for[] INIT(= N_("E588: :endfor without :for"));
-EXTERN char e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
-EXTERN char e_failed[] INIT(= N_("E472: Command failed"));
-EXTERN char e_internal[] INIT(= N_("E473: Internal error"));
-EXTERN char e_intern2[] INIT(= N_("E685: Internal error: %s"));
-EXTERN char e_interr[] INIT(= N_("Interrupted"));
-EXTERN char e_invarg[] INIT(= N_("E474: Invalid argument"));
-EXTERN char e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
-EXTERN char e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
-EXTERN char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
-EXTERN char e_duparg2[] INIT(= N_("E983: Duplicate argument: %s"));
-EXTERN char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
-EXTERN char e_invrange[] INIT(= N_("E16: Invalid range"));
-EXTERN char e_invcmd[] INIT(= N_("E476: Invalid command"));
-EXTERN char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
-EXTERN char e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
-EXTERN char e_invchan[] INIT(= N_("E900: Invalid channel id"));
-EXTERN char e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job"));
-EXTERN char e_jobtblfull[] INIT(= N_("E901: Job table is full"));
-EXTERN char e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\""));
-EXTERN char e_channotpty[] INIT(= N_("E904: channel is not a pty"));
-EXTERN char e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s"));
-EXTERN char e_invstream[] INIT(= N_("E906: invalid stream for channel"));
-EXTERN char e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'"));
-EXTERN char e_streamkey[] INIT(= N_("E5210: dict key '%s' already set for buffered stream in channel %" PRIu64));
-EXTERN char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
-EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed: %s"));
-EXTERN char e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
-EXTERN char e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
-EXTERN char e_marknotset[] INIT(= N_("E20: Mark not set"));
-EXTERN char e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off"));
-EXTERN char e_nesting[] INIT(= N_("E22: Scripts nested too deep"));
-EXTERN char e_noalt[] INIT(= N_("E23: No alternate file"));
-EXTERN char e_noabbr[] INIT(= N_("E24: No such abbreviation"));
-EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed"));
-EXTERN char e_nogroup[] INIT(= N_("E28: No such highlight group name: %s"));
-EXTERN char e_noinstext[] INIT(= N_("E29: No inserted text yet"));
-EXTERN char e_nolastcmd[] INIT(= N_("E30: No previous command line"));
-EXTERN char e_nomap[] INIT(= N_("E31: No such mapping"));
-EXTERN char e_nomatch[] INIT(= N_("E479: No match"));
-EXTERN char e_nomatch2[] INIT(= N_("E480: No match: %s"));
-EXTERN char e_noname[] INIT(= N_("E32: No file name"));
-EXTERN char e_nopresub[] INIT(= N_("E33: No previous substitute regular expression"));
-EXTERN char e_noprev[] INIT(= N_("E34: No previous command"));
-EXTERN char e_noprevre[] INIT(= N_("E35: No previous regular expression"));
-EXTERN char e_norange[] INIT(= N_("E481: No range allowed"));
-EXTERN char e_noroom[] INIT(= N_("E36: Not enough room"));
-EXTERN char e_notmp[] INIT(= N_("E483: Can't get temp file name"));
-EXTERN char e_notopen[] INIT(= N_("E484: Can't open file %s"));
-EXTERN char e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s"));
-EXTERN char e_notread[] INIT(= N_("E485: Can't read file %s"));
-EXTERN char e_null[] INIT(= N_("E38: Null argument"));
-EXTERN char e_number_exp[] INIT(= N_("E39: Number expected"));
-EXTERN char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s"));
-EXTERN char e_outofmem[] INIT(= N_("E41: Out of memory!"));
-EXTERN char e_patnotf[] INIT(= N_("Pattern not found"));
-EXTERN char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s"));
-EXTERN char e_positive[] INIT(= N_("E487: Argument must be positive"));
-EXTERN char e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory"));
-
-EXTERN char e_no_errors[] INIT(= N_("E42: No Errors"));
-EXTERN char e_loclist[] INIT(= N_("E776: No location list"));
-EXTERN char e_re_damg[] INIT(= N_("E43: Damaged match string"));
-EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
-EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
-EXTERN char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
-EXTERN char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
-EXTERN char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
-EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\""));
-EXTERN char e_stringreq[] INIT(= N_("E928: String required"));
-EXTERN char e_dictreq[] INIT(= N_("E715: Dictionary required"));
-EXTERN char e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64));
-EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
-EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
-EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
-EXTERN char e_listreq[] INIT(= N_("E714: List required"));
-EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
-EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
-EXTERN char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob"));
-EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
-EXTERN char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
-EXTERN char e_secure[] INIT(= N_("E523: Not allowed here"));
-EXTERN char e_textlock[] INIT(= N_("E565: Not allowed to change text or change window"));
-EXTERN char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
-EXTERN char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
-EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
-EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
-EXTERN char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
-EXTERN char e_tagstack[] INIT(= N_("E73: tag stack empty"));
-EXTERN char e_toocompl[] INIT(= N_("E74: Command too complex"));
-EXTERN char e_longname[] INIT(= N_("E75: Name too long"));
-EXTERN char e_toomsbra[] INIT(= N_("E76: Too many ["));
-EXTERN char e_toomany[] INIT(= N_("E77: Too many file names"));
-EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters"));
-EXTERN char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
-EXTERN char e_umark[] INIT(= N_("E78: Unknown mark"));
-EXTERN char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
-EXTERN char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
-EXTERN char e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
-EXTERN char e_write[] INIT(= N_("E80: Error while writing"));
-EXTERN char e_zerocount[] INIT(= N_("E939: Positive count required"));
-EXTERN char e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
-EXTERN char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
-EXTERN char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
-EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer"));
-EXTERN char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
-
-EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
-EXTERN char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
-EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set"));
-EXTERN char e_invalidreg[] INIT(= N_("E850: Invalid register name"));
-EXTERN char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
-EXTERN char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
-EXTERN char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode"));
-EXTERN char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window"));
-EXTERN char e_listarg[] INIT(= N_("E686: Argument of %s must be a List"));
-EXTERN char e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
-EXTERN char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
-EXTERN char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
-EXTERN char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now"));
-
-EXTERN char e_cmdmap_err[] INIT(= N_("E5520: <Cmd> mapping must end with <CR>"));
-EXTERN char e_cmdmap_repeated[]
+EXTERN const char e_abort[] INIT(= N_("E470: Command aborted"));
+EXTERN const char e_afterinit[] INIT(= N_("E905: Cannot set this option after startup"));
+EXTERN const char e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job"));
+EXTERN const char e_argreq[] INIT(= N_("E471: Argument required"));
+EXTERN const char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
+EXTERN const char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
+EXTERN const char e_curdir[] INIT(= N_("E12: Command not allowed in secure mode in current dir or tag search"));
+EXTERN const char e_command_too_recursive[] INIT(= N_("E169: Command too recursive"));
+EXTERN const char e_endif[] INIT(= N_("E171: Missing :endif"));
+EXTERN const char e_endtry[] INIT(= N_("E600: Missing :endtry"));
+EXTERN const char e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
+EXTERN const char e_endfor[] INIT(= N_("E170: Missing :endfor"));
+EXTERN const char e_while[] INIT(= N_("E588: :endwhile without :while"));
+EXTERN const char e_for[] INIT(= N_("E588: :endfor without :for"));
+EXTERN const char e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
+EXTERN const char e_failed[] INIT(= N_("E472: Command failed"));
+EXTERN const char e_internal[] INIT(= N_("E473: Internal error"));
+EXTERN const char e_intern2[] INIT(= N_("E685: Internal error: %s"));
+EXTERN const char e_interr[] INIT(= N_("Interrupted"));
+EXTERN const char e_invarg[] INIT(= N_("E474: Invalid argument"));
+EXTERN const char e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
+EXTERN const char e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
+EXTERN const char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
+EXTERN const char e_duparg2[] INIT(= N_("E983: Duplicate argument: %s"));
+EXTERN const char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
+EXTERN const char e_invrange[] INIT(= N_("E16: Invalid range"));
+EXTERN const char e_invcmd[] INIT(= N_("E476: Invalid command"));
+EXTERN const char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
+EXTERN const char e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
+EXTERN const char e_invchan[] INIT(= N_("E900: Invalid channel id"));
+EXTERN const char e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job"));
+EXTERN const char e_jobtblfull[] INIT(= N_("E901: Job table is full"));
+EXTERN const char e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\""));
+EXTERN const char e_channotpty[] INIT(= N_("E904: channel is not a pty"));
+EXTERN const char e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s"));
+EXTERN const char e_invstream[] INIT(= N_("E906: invalid stream for channel"));
+EXTERN const char e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'"));
+EXTERN const char e_streamkey[] INIT(= N_("E5210: dict key '%s' already set for buffered stream in channel %" PRIu64));
+EXTERN const char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
+EXTERN const char e_fsync[] INIT(= N_("E667: Fsync failed: %s"));
+EXTERN const char e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
+EXTERN const char e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
+EXTERN const char e_marknotset[] INIT(= N_("E20: Mark not set"));
+EXTERN const char e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off"));
+EXTERN const char e_nesting[] INIT(= N_("E22: Scripts nested too deep"));
+EXTERN const char e_noalt[] INIT(= N_("E23: No alternate file"));
+EXTERN const char e_noabbr[] INIT(= N_("E24: No such abbreviation"));
+EXTERN const char e_nobang[] INIT(= N_("E477: No ! allowed"));
+EXTERN const char e_nogroup[] INIT(= N_("E28: No such highlight group name: %s"));
+EXTERN const char e_noinstext[] INIT(= N_("E29: No inserted text yet"));
+EXTERN const char e_nolastcmd[] INIT(= N_("E30: No previous command line"));
+EXTERN const char e_nomap[] INIT(= N_("E31: No such mapping"));
+EXTERN const char e_nomatch[] INIT(= N_("E479: No match"));
+EXTERN const char e_nomatch2[] INIT(= N_("E480: No match: %s"));
+EXTERN const char e_noname[] INIT(= N_("E32: No file name"));
+EXTERN const char e_nopresub[] INIT(= N_("E33: No previous substitute regular expression"));
+EXTERN const char e_noprev[] INIT(= N_("E34: No previous command"));
+EXTERN const char e_noprevre[] INIT(= N_("E35: No previous regular expression"));
+EXTERN const char e_norange[] INIT(= N_("E481: No range allowed"));
+EXTERN const char e_noroom[] INIT(= N_("E36: Not enough room"));
+EXTERN const char e_notmp[] INIT(= N_("E483: Can't get temp file name"));
+EXTERN const char e_notopen[] INIT(= N_("E484: Can't open file %s"));
+EXTERN const char e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s"));
+EXTERN const char e_notread[] INIT(= N_("E485: Can't read file %s"));
+EXTERN const char e_null[] INIT(= N_("E38: Null argument"));
+EXTERN const char e_number_exp[] INIT(= N_("E39: Number expected"));
+EXTERN const char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s"));
+EXTERN const char e_outofmem[] INIT(= N_("E41: Out of memory!"));
+EXTERN const char e_patnotf[] INIT(= N_("Pattern not found"));
+EXTERN const char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s"));
+EXTERN const char e_positive[] INIT(= N_("E487: Argument must be positive"));
+EXTERN const char e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory"));
+
+EXTERN const char e_no_errors[] INIT(= N_("E42: No Errors"));
+EXTERN const char e_loclist[] INIT(= N_("E776: No location list"));
+EXTERN const char e_re_damg[] INIT(= N_("E43: Damaged match string"));
+EXTERN const char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
+EXTERN const char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
+EXTERN const char e_letwrong[] INIT(= N_("E734: Wrong variable type for %s="));
+EXTERN const char e_illvar[] INIT(= N_("E461: Illegal variable name: %s"));
+EXTERN const char e_cannot_mod[] INIT(= N_("E995: Cannot modify existing variable"));
+EXTERN const char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\""));
+EXTERN const char e_stringreq[] INIT(= N_("E928: String required"));
+EXTERN const char e_dictreq[] INIT(= N_("E715: Dictionary required"));
+EXTERN const char e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64));
+EXTERN const char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
+EXTERN const char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
+EXTERN const char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
+EXTERN const char e_listreq[] INIT(= N_("E714: List required"));
+EXTERN const char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
+EXTERN const char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
+EXTERN const char e_listdictblobarg[] INIT(= N_("E896: Argument of %s must be a List, Dictionary or Blob"));
+EXTERN const char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
+EXTERN const char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
+EXTERN const char e_secure[] INIT(= N_("E523: Not allowed here"));
+EXTERN const char e_textlock[] INIT(= N_("E565: Not allowed to change text or change window"));
+EXTERN const char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
+EXTERN const char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
+EXTERN const char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
+EXTERN const char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
+EXTERN const char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
+EXTERN const char e_tagstack[] INIT(= N_("E73: tag stack empty"));
+EXTERN const char e_toocompl[] INIT(= N_("E74: Command too complex"));
+EXTERN const char e_longname[] INIT(= N_("E75: Name too long"));
+EXTERN const char e_toomsbra[] INIT(= N_("E76: Too many ["));
+EXTERN const char e_toomany[] INIT(= N_("E77: Too many file names"));
+EXTERN const char e_trailing[] INIT(= N_("E488: Trailing characters"));
+EXTERN const char e_trailing_arg[] INIT(= N_("E488: Trailing characters: %s"));
+EXTERN const char e_umark[] INIT(= N_("E78: Unknown mark"));
+EXTERN const char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
+EXTERN const char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
+EXTERN const char e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
+EXTERN const char e_write[] INIT(= N_("E80: Error while writing"));
+EXTERN const char e_zerocount[] INIT(= N_("E939: Positive count required"));
+EXTERN const char e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
+EXTERN const char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
+EXTERN const char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
+EXTERN const char e_emptybuf[] INIT(= N_("E749: empty buffer"));
+EXTERN const char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
+
+EXTERN const char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
+EXTERN const char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
+EXTERN const char e_notset[] INIT(= N_("E764: Option '%s' is not set"));
+EXTERN const char e_invalidreg[] INIT(= N_("E850: Invalid register name"));
+EXTERN const char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
+EXTERN const char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
+EXTERN const char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode"));
+EXTERN const char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window"));
+EXTERN const char e_listarg[] INIT(= N_("E686: Argument of %s must be a List"));
+EXTERN const char e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
+EXTERN const char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
+EXTERN const char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
+EXTERN const char e_cannot_edit_other_buf[] INIT(= N_("E788: Not allowed to edit another buffer now"));
+
+EXTERN const char e_cmdmap_err[] INIT(= N_("E5520: <Cmd> mapping must end with <CR>"));
+EXTERN const char e_cmdmap_repeated[]
INIT(= N_("E5521: <Cmd> mapping must end with <CR> before second <Cmd>"));
-EXTERN char e_api_error[] INIT(= N_("E5555: API call: %s"));
+EXTERN const char e_api_error[] INIT(= N_("E5555: API call: %s"));
-EXTERN char e_luv_api_disabled[] INIT(= N_("E5560: %s must not be called in a lua loop callback"));
+EXTERN const char e_luv_api_disabled[] INIT(= N_("E5560: %s must not be called in a lua loop callback"));
-EXTERN char e_floatonly[] INIT(= N_("E5601: Cannot close window, only floating window would remain"));
-EXTERN char e_floatexchange[] INIT(= N_("E5602: Cannot exchange or rotate float"));
+EXTERN const char e_floatonly[] INIT(= N_("E5601: Cannot close window, only floating window would remain"));
+EXTERN const char e_floatexchange[] INIT(= N_("E5602: Cannot exchange or rotate float"));
-EXTERN char e_cannot_define_autocommands_for_all_events[] INIT(= N_("E1155: Cannot define autocommands for ALL events"));
+EXTERN const char e_cannot_define_autocommands_for_all_events[] INIT(= N_("E1155: Cannot define autocommands for ALL events"));
-EXTERN char e_resulting_text_too_long[] INIT(= N_("E1240: Resulting text too long"));
+EXTERN const char e_resulting_text_too_long[] INIT(= N_("E1240: Resulting text too long"));
-EXTERN char e_line_number_out_of_range[] INIT(= N_("E1247: Line number out of range"));
+EXTERN const char e_line_number_out_of_range[] INIT(= N_("E1247: Line number out of range"));
-EXTERN char e_highlight_group_name_invalid_char[] INIT(= N_("E5248: Invalid character in group name"));
+EXTERN const char e_highlight_group_name_invalid_char[] INIT(= N_("E5248: Invalid character in group name"));
-EXTERN char e_highlight_group_name_too_long[] INIT(= N_("E1249: Highlight group name too long"));
+EXTERN const char e_highlight_group_name_too_long[] INIT(= N_("E1249: Highlight group name too long"));
-EXTERN char e_invalid_line_number_nr[] INIT(= N_("E966: Invalid line number: %ld"));
+EXTERN const char e_invalid_line_number_nr[] INIT(= N_("E966: Invalid line number: %ld"));
-EXTERN char e_undobang_cannot_redo_or_move_branch[]
+EXTERN const char e_undobang_cannot_redo_or_move_branch[]
INIT(= N_("E5767: Cannot use :undo! to redo or move to a different undo branch"));
-EXTERN char e_trustfile[] INIT(= N_("E5570: Cannot update trust file: %s"));
+EXTERN const char e_trustfile[] INIT(= N_("E5570: Cannot update trust file: %s"));
-EXTERN char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
-EXTERN char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
+EXTERN const char top_bot_msg[] INIT(= N_("search hit TOP, continuing at BOTTOM"));
+EXTERN const char bot_top_msg[] INIT(= N_("search hit BOTTOM, continuing at TOP"));
-EXTERN char line_msg[] INIT(= N_(" line "));
+EXTERN const char line_msg[] INIT(= N_(" line "));
EXTERN FILE *time_fd INIT(= NULL); // where to write startup timing
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index 7100146245..50107cdfea 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -187,8 +187,8 @@ typedef enum {
CP_FAST = 32, ///< use fast_breakcheck instead of os_breakcheck
} cp_flags_T;
-static char e_hitend[] = N_("Hit end of paragraph");
-static char e_compldel[] = N_("E840: Completion function deleted text");
+static const char e_hitend[] = N_("Hit end of paragraph");
+static const char e_compldel[] = N_("E840: Completion function deleted text");
// All the current matches are stored in a list.
// "compl_first_match" points to the start of the list.
@@ -2257,7 +2257,7 @@ static void copy_global_to_buflocal_cb(Callback *globcb, Callback *bufcb)
/// Invoked when the 'completefunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-void set_completefunc_option(char **errmsg)
+void set_completefunc_option(const char **errmsg)
{
if (option_set_callback_func(curbuf->b_p_cfu, &cfu_cb) == FAIL) {
*errmsg = e_invarg;
@@ -2278,7 +2278,7 @@ void set_buflocal_cfu_callback(buf_T *buf)
/// Invoked when the 'omnifunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-void set_omnifunc_option(buf_T *buf, char **errmsg)
+void set_omnifunc_option(buf_T *buf, const char **errmsg)
{
if (option_set_callback_func(buf->b_p_ofu, &ofu_cb) == FAIL) {
*errmsg = e_invarg;
@@ -2298,7 +2298,7 @@ void set_buflocal_ofu_callback(buf_T *buf)
/// Invoked when the 'thesaurusfunc' option is set. The option value can be a
/// name of a function (string), or function(<name>) or funcref(<name>) or a
/// lambda expression.
-void set_thesaurusfunc_option(char **errmsg)
+void set_thesaurusfunc_option(const char **errmsg)
{
int retval;
diff --git a/src/nvim/match.c b/src/nvim/match.c
index 29d4b7c225..ccce78e59d 100644
--- a/src/nvim/match.c
+++ b/src/nvim/match.c
@@ -42,7 +42,7 @@
# include "match.c.generated.h"
#endif
-static char *e_invalwindow = N_("E957: Invalid window number");
+static const char *e_invalwindow = N_("E957: Invalid window number");
#define SEARCH_HL_PRIORITY 0
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index c580dc29e6..340a05f29d 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -87,17 +87,17 @@ struct interval {
#endif
// uncrustify:on
-static char e_list_item_nr_is_not_list[]
+static const char e_list_item_nr_is_not_list[]
= N_("E1109: List item %d is not a List");
-static char e_list_item_nr_does_not_contain_3_numbers[]
+static const char e_list_item_nr_does_not_contain_3_numbers[]
= N_("E1110: List item %d does not contain 3 numbers");
-static char e_list_item_nr_range_invalid[]
+static const char e_list_item_nr_range_invalid[]
= N_("E1111: List item %d range invalid");
-static char e_list_item_nr_cell_width_invalid[]
+static const char e_list_item_nr_cell_width_invalid[]
= N_("E1112: List item %d cell width invalid");
-static char e_overlapping_ranges_for_nr[]
+static const char e_overlapping_ranges_for_nr[]
= N_("E1113: Overlapping ranges for 0x%lx");
-static char e_only_values_of_0x80_and_higher_supported[]
+static const char e_only_values_of_0x80_and_higher_supported[]
= N_("E1114: Only values of 0x80 and higher supported");
// To speed up BYTELEN(); keep a lookup table to quickly get the length in
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 4fad926cb0..684bd92390 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -50,8 +50,8 @@
/// The character for each menu mode
static char *menu_mode_chars[] = { "n", "v", "s", "o", "i", "c", "tl", "t" };
-static char e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu");
-static char e_nomenu[] = N_("E329: No menu \"%s\"");
+static const char e_notsubmenu[] = N_("E327: Part of menu-item path is not sub-menu");
+static const char e_nomenu[] = N_("E329: No menu \"%s\"");
// Return true if "name" is a window toolbar menu name.
static bool menu_is_winbar(const char *const name)
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 6ad1cbd987..66c24fb444 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -117,7 +117,7 @@ static inline void normal_state_init(NormalState *s)
// n_*(): functions called to handle Normal mode commands.
// v_*(): functions called to handle Visual mode commands.
-static char *e_noident = N_("E349: No identifier under cursor");
+static const char *e_noident = N_("E349: No identifier under cursor");
/// Function to be called for a Normal or Visual mode command.
/// The argument is a cmdarg_T.
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index d66ed9abff..d2e9fda7d9 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -5628,7 +5628,7 @@ static void op_colon(oparg_T *oap)
static Callback opfunc_cb;
/// Process the 'operatorfunc' option value.
-void set_operatorfunc_option(char **errmsg)
+void set_operatorfunc_option(const char **errmsg)
{
if (option_set_callback_func(p_opfunc, &opfunc_cb) == FAIL) {
*errmsg = e_invarg;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 8fa719c3a9..a5170715d6 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -105,17 +105,17 @@
# include "nvim/arglist.h"
#endif
-static char e_unknown_option[]
+static const char e_unknown_option[]
= N_("E518: Unknown option");
-static char e_not_allowed_in_modeline[]
+static const char e_not_allowed_in_modeline[]
= N_("E520: Not allowed in a modeline");
-static char e_not_allowed_in_modeline_when_modelineexpr_is_off[]
+static const char e_not_allowed_in_modeline_when_modelineexpr_is_off[]
= N_("E992: Not allowed in a modeline when 'modelineexpr' is off");
-static char e_key_code_not_set[]
+static const char e_key_code_not_set[]
= N_("E846: Key code not set");
-static char e_number_required_after_equal[]
+static const char e_number_required_after_equal[]
= N_("E521: Number required after =");
-static char e_preview_window_already_exists[]
+static const char e_preview_window_already_exists[]
= N_("E590: A preview window already exists");
static char *p_term = NULL;
@@ -747,7 +747,7 @@ void ex_set(exarg_T *eap)
}
static void do_set_bool(int opt_idx, int opt_flags, int prefix, int nextchar, const char *varp,
- char **errmsg)
+ const char **errmsg)
{
varnumber_T value;
@@ -777,7 +777,7 @@ static void do_set_bool(int opt_idx, int opt_flags, int prefix, int nextchar, co
}
static void do_set_num(int opt_idx, int opt_flags, char **argp, int nextchar, const set_op_T op,
- const char *varp, char *errbuf, size_t errbuflen, char **errmsg)
+ const char *varp, char *errbuf, size_t errbuflen, const char **errmsg)
{
varnumber_T value;
char *arg = *argp;
@@ -911,7 +911,7 @@ static void munge_string_opt_val(char **varp, char **oldval, char **const origva
/// Part of do_set() for string options.
static void do_set_string(int opt_idx, int opt_flags, char **argp, int nextchar, set_op_T op_arg,
uint32_t flags, char *varp_arg, char *errbuf, size_t errbuflen,
- int *value_checked, char **errmsg)
+ int *value_checked, const char **errmsg)
{
char *arg = *argp;
set_op_T op = op_arg;
@@ -1265,7 +1265,7 @@ static int parse_option_name(char *arg, int *keyp, int *lenp, int *opt_idxp)
}
static int validate_opt_idx(win_T *win, int opt_idx, int opt_flags, uint32_t flags, int prefix,
- char **errmsg)
+ const char **errmsg)
{
// Only bools can have a prefix of 'inv' or 'no'
if (!(flags & P_BOOL) && prefix != 1) {
@@ -1318,7 +1318,7 @@ static int validate_opt_idx(win_T *win, int opt_idx, int opt_flags, uint32_t fla
static void do_set_option_value(int opt_idx, int opt_flags, char **argp, int prefix, int nextchar,
set_op_T op, uint32_t flags, char *varp, char *errbuf,
- size_t errbuflen, char **errmsg)
+ size_t errbuflen, const char **errmsg)
{
int value_checked = false;
if (flags & P_BOOL) { // boolean
@@ -1343,7 +1343,7 @@ static void do_set_option_value(int opt_idx, int opt_flags, char **argp, int pre
}
static void do_set_option(int opt_flags, char **argp, bool *did_show, char *errbuf,
- size_t errbuflen, char **errmsg)
+ size_t errbuflen, const char **errmsg)
{
// 1: nothing, 0: "no", 2: "inv" in front of name
int prefix = get_option_prefix(argp);
@@ -1521,7 +1521,7 @@ int do_set(char *arg, int opt_flags)
}
} else {
char *startarg = arg; // remember for error message
- char *errmsg = NULL;
+ const char *errmsg = NULL;
char errbuf[80];
do_set_option(opt_flags, &arg, &did_show, errbuf, sizeof(errbuf), &errmsg);
@@ -1992,12 +1992,12 @@ static void apply_optionset_autocmd(int opt_idx, long opt_flags, long oldval, lo
/// @param[in] opt_flags OPT_LOCAL and/or OPT_GLOBAL.
///
/// @return NULL on success, error message on error.
-static char *set_bool_option(const int opt_idx, char *const varp, const int value,
- const int opt_flags)
+static const char *set_bool_option(const int opt_idx, char *const varp, const int value,
+ const int opt_flags)
{
int old_value = *(int *)varp;
int old_global_value = 0;
- char *errmsg = NULL;
+ const char *errmsg = NULL;
// Disallow changing some options from secure mode
if ((secure || sandbox != 0)
@@ -2274,10 +2274,10 @@ static char *set_bool_option(const int opt_idx, char *const varp, const int valu
/// @param[in] opt_flags OPT_LOCAL, OPT_GLOBAL or OPT_MODELINE.
///
/// @return NULL on success, error message on error.
-static char *set_num_option(int opt_idx, char *varp, long value, char *errbuf, size_t errbuflen,
- int opt_flags)
+static const char *set_num_option(int opt_idx, char *varp, long value, char *errbuf,
+ size_t errbuflen, int opt_flags)
{
- char *errmsg = NULL;
+ const char *errmsg = NULL;
long old_value = *(long *)varp;
long old_global_value = 0; // only used when setting a local and global option
long old_Rows = Rows; // remember old Rows
@@ -3078,8 +3078,8 @@ vimoption_T *get_option(int opt_idx)
/// on the option).
///
/// @return NULL on success, an untranslated error message on error.
-char *set_option_value(const char *const name, const long number, const char *const string,
- const int opt_flags)
+const char *set_option_value(const char *const name, const long number, const char *const string,
+ const int opt_flags)
FUNC_ATTR_NONNULL_ARG(1)
{
static char errbuf[80];
@@ -3154,7 +3154,7 @@ char *set_option_value(const char *const name, const long number, const char *co
/// @param opt_flags OPT_LOCAL or 0 (both)
void set_option_value_give_err(const char *name, long number, const char *string, int opt_flags)
{
- char *errmsg = set_option_value(name, number, string, opt_flags);
+ const char *errmsg = set_option_value(name, number, string, opt_flags);
if (errmsg != NULL) {
emsg(_(errmsg));
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index bf4ebbb3e2..3372c7b6c6 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -59,13 +59,13 @@
# include "optionstr.c.generated.h"
#endif
-static char e_unclosed_expression_sequence[]
+static const char e_unclosed_expression_sequence[]
= N_("E540: Unclosed expression sequence");
-static char e_unbalanced_groups[]
+static const char e_unbalanced_groups[]
= N_("E542: unbalanced groups");
-static char e_backupext_and_patchmode_are_equal[]
+static const char e_backupext_and_patchmode_are_equal[]
= N_("E589: 'backupext' and 'patchmode' are equal");
-static char e_showbreak_contains_unprintable_or_wide_character[]
+static const char e_showbreak_contains_unprintable_or_wide_character[]
= N_("E595: 'showbreak' contains unprintable or wide character");
static char *(p_ambw_values[]) = { "single", "double", NULL };
@@ -410,8 +410,8 @@ void set_string_option_direct_in_win(win_T *wp, const char *name, int opt_idx, c
/// #OPT_GLOBAL.
///
/// @return NULL on success, an untranslated error message on error.
-char *set_string_option(const int opt_idx, const char *const value, const int opt_flags,
- char *const errbuf, const size_t errbuflen)
+const char *set_string_option(const int opt_idx, const char *const value, const int opt_flags,
+ char *const errbuf, const size_t errbuflen)
FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_WARN_UNUSED_RESULT
{
vimoption_T *opt = get_option(opt_idx);
@@ -442,9 +442,8 @@ char *set_string_option(const int opt_idx, const char *const value, const int op
char *const saved_newval = xstrdup(s);
int value_checked = false;
- char *const errmsg = did_set_string_option(opt_idx, varp, oldval,
- errbuf, errbuflen,
- opt_flags, &value_checked);
+ const char *const errmsg = did_set_string_option(opt_idx, varp, oldval, errbuf, errbuflen,
+ opt_flags, &value_checked);
if (errmsg == NULL) {
did_set_option(opt_idx, opt_flags, true, value_checked);
}
@@ -478,7 +477,7 @@ static bool valid_filetype(const char *val)
/// Handle setting 'mousescroll'.
/// @return error message, NULL if it's OK.
-static char *check_mousescroll(char *string)
+static const char *check_mousescroll(char *string)
{
long vertical = -1;
long horizontal = -1;
@@ -571,7 +570,7 @@ static int check_signcolumn(char *val)
/// Check validity of options with the 'statusline' format.
/// Return an untranslated error message or NULL.
-char *check_stl_option(char *s)
+const char *check_stl_option(char *s)
{
int groupdepth = 0;
static char errbuf[80];
@@ -650,7 +649,7 @@ static bool check_illegal_path_names(char *val, uint32_t flags)
&& strpbrk(val, "*?[|;&<>\r\n") != NULL));
}
-static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, char **errmsg)
+static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, const char **errmsg)
{
char *bkc = p_bkc;
unsigned int *flags = &bkc_flags;
@@ -678,7 +677,7 @@ static void did_set_backupcopy(buf_T *buf, char *oldval, int opt_flags, char **e
}
}
-static void did_set_backupext_or_patchmode(char **errmsg)
+static void did_set_backupext_or_patchmode(const char **errmsg)
{
if (strcmp(*p_bex == '.' ? p_bex + 1 : p_bex,
*p_pm == '.' ? p_pm + 1 : p_pm) == 0) {
@@ -686,7 +685,7 @@ static void did_set_backupext_or_patchmode(char **errmsg)
}
}
-static void did_set_breakindentopt(win_T *win, char **errmsg)
+static void did_set_breakindentopt(win_T *win, const char **errmsg)
{
if (briopt_check(win) == FAIL) {
*errmsg = e_invarg;
@@ -697,7 +696,7 @@ static void did_set_breakindentopt(win_T *win, char **errmsg)
}
}
-static void did_set_isopt(buf_T *buf, bool *did_chartab, char **errmsg)
+static void did_set_isopt(buf_T *buf, bool *did_chartab, const char **errmsg)
{
// 'isident', 'iskeyword', 'isprint or 'isfname' option: refill g_chartab[]
// If the new option is invalid, use old value.
@@ -719,14 +718,14 @@ static void did_set_helpfile(void)
}
}
-static void did_set_cursorlineopt(win_T *win, char **varp, char **errmsg)
+static void did_set_cursorlineopt(win_T *win, char **varp, const char **errmsg)
{
if (**varp == NUL || fill_culopt_flags(*varp, win) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_helplang(char **errmsg)
+static void did_set_helplang(const char **errmsg)
{
// Check for "", "ab", "ab,cd", etc.
for (char *s = p_hlg; *s != NUL; s += 3) {
@@ -740,26 +739,27 @@ static void did_set_helplang(char **errmsg)
}
}
-static void did_set_highlight(char **varp, char **errmsg)
+static void did_set_highlight(char **varp, const char **errmsg)
{
if (strcmp(*varp, HIGHLIGHT_INIT) != 0) {
*errmsg = e_unsupportedoption;
}
}
-static void did_set_opt_flags(char *val, char **values, unsigned *flagp, bool list, char **errmsg)
+static void did_set_opt_flags(char *val, char **values, unsigned *flagp, bool list,
+ const char **errmsg)
{
if (opt_strings_flags(val, values, flagp, list) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_opt_strings(char *val, char **values, bool list, char **errmsg)
+static void did_set_opt_strings(char *val, char **values, bool list, const char **errmsg)
{
did_set_opt_flags(val, values, NULL, list, errmsg);
}
-static void did_set_sessionoptions(char *oldval, char **errmsg)
+static void did_set_sessionoptions(char *oldval, const char **errmsg)
{
if (opt_strings_flags(p_ssop, p_ssop_values, &ssop_flags, true) != OK) {
*errmsg = e_invarg;
@@ -771,7 +771,7 @@ static void did_set_sessionoptions(char *oldval, char **errmsg)
}
}
-static void did_set_ambiwidth(char **errmsg)
+static void did_set_ambiwidth(const char **errmsg)
{
if (check_opt_strings(p_ambw, p_ambw_values, false) != OK) {
*errmsg = e_invarg;
@@ -780,7 +780,7 @@ static void did_set_ambiwidth(char **errmsg)
}
}
-static void did_set_background(char **errmsg)
+static void did_set_background(const char **errmsg)
{
if (check_opt_strings(p_bg, p_bg_values, false) != OK) {
*errmsg = e_invarg;
@@ -803,21 +803,21 @@ static void did_set_background(char **errmsg)
}
}
-static void did_set_wildmode(char **errmsg)
+static void did_set_wildmode(const char **errmsg)
{
if (check_opt_wim() == FAIL) {
*errmsg = e_invarg;
}
}
-static void did_set_winaltkeys(char **errmsg)
+static void did_set_winaltkeys(const char **errmsg)
{
if (*p_wak == NUL || check_opt_strings(p_wak, p_wak_values, false) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_eventignore(char **errmsg)
+static void did_set_eventignore(const char **errmsg)
{
if (check_ei() == FAIL) {
*errmsg = e_invarg;
@@ -825,7 +825,8 @@ static void did_set_eventignore(char **errmsg)
}
// 'encoding', 'fileencoding' and 'makeencoding'
-static void did_set_encoding(buf_T *buf, char **varp, char **gvarp, int opt_flags, char **errmsg)
+static void did_set_encoding(buf_T *buf, char **varp, char **gvarp, int opt_flags,
+ const char **errmsg)
{
if (gvarp == &p_fenc) {
if (!MODIFIABLE(buf) && opt_flags != OPT_GLOBAL) {
@@ -861,7 +862,7 @@ static void did_set_encoding(buf_T *buf, char **varp, char **gvarp, int opt_flag
}
static void did_set_keymap(buf_T *buf, char **varp, int opt_flags, int *value_checked,
- char **errmsg)
+ const char **errmsg)
{
if (!valid_filetype(*varp)) {
*errmsg = e_invarg;
@@ -908,7 +909,7 @@ static void did_set_keymap(buf_T *buf, char **varp, int opt_flags, int *value_ch
}
static void did_set_fileformat(buf_T *buf, char **varp, const char *oldval, int opt_flags,
- char **errmsg)
+ const char **errmsg)
{
if (!MODIFIABLE(buf) && !(opt_flags & OPT_GLOBAL)) {
*errmsg = e_modifiable;
@@ -926,7 +927,7 @@ static void did_set_fileformat(buf_T *buf, char **varp, const char *oldval, int
}
}
-static void did_set_matchpairs(char **varp, char **errmsg)
+static void did_set_matchpairs(char **varp, const char **errmsg)
{
for (char *p = *varp; *p != NUL; p++) {
int x2 = -1;
@@ -950,7 +951,7 @@ static void did_set_matchpairs(char **varp, char **errmsg)
}
}
-static void did_set_comments(char **varp, char *errbuf, size_t errbuflen, char **errmsg)
+static void did_set_comments(char **varp, char *errbuf, size_t errbuflen, const char **errmsg)
{
for (char *s = *varp; *s;) {
while (*s && *s != ':') {
@@ -979,7 +980,8 @@ static void did_set_comments(char **varp, char *errbuf, size_t errbuflen, char *
}
}
-static void did_set_global_listfillchars(win_T *win, char **varp, int opt_flags, char **errmsg)
+static void did_set_global_listfillchars(win_T *win, char **varp, int opt_flags,
+ const char **errmsg)
{
char **local_ptr = varp == &p_lcs ? &win->w_p_lcs : &win->w_p_fcs;
// only apply the global value to "win" when it does not have a local value
@@ -1004,7 +1006,7 @@ static void did_set_global_listfillchars(win_T *win, char **varp, int opt_flags,
}
}
-static void did_set_verbosefile(char **errmsg)
+static void did_set_verbosefile(const char **errmsg)
{
verbose_stop();
if (*p_vfile != NUL && verbose_open() == FAIL) {
@@ -1015,7 +1017,7 @@ static void did_set_verbosefile(char **errmsg)
static int shada_idx = -1;
static void did_set_shada(vimoption_T **opt, int *opt_idx, bool *free_oldval, char *errbuf,
- size_t errbuflen, char **errmsg)
+ size_t errbuflen, const char **errmsg)
{
// TODO(ZyX-I): Remove this code in the future, alongside with &viminfo
// option.
@@ -1073,7 +1075,7 @@ static void did_set_shada(vimoption_T **opt, int *opt_idx, bool *free_oldval, ch
}
}
-static void did_set_showbreak(char **varp, char **errmsg)
+static void did_set_showbreak(char **varp, const char **errmsg)
{
for (char *s = *varp; *s;) {
if (ptr2cells(s) != 1) {
@@ -1097,14 +1099,14 @@ static void did_set_titleiconstring(char **varp)
did_set_title();
}
-static void did_set_selection(char **errmsg)
+static void did_set_selection(const char **errmsg)
{
if (*p_sel == NUL || check_opt_strings(p_sel, p_sel_values, false) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_keymodel(char **errmsg)
+static void did_set_keymodel(const char **errmsg)
{
if (check_opt_strings(p_km, p_km_values, true) != OK) {
*errmsg = e_invarg;
@@ -1114,7 +1116,7 @@ static void did_set_keymodel(char **errmsg)
km_startsel = (vim_strchr(p_km, 'a') != NULL);
}
-static void did_set_display(char **errmsg)
+static void did_set_display(const char **errmsg)
{
if (opt_strings_flags(p_dy, p_dy_values, &dy_flags, true) != OK) {
*errmsg = e_invarg;
@@ -1124,7 +1126,7 @@ static void did_set_display(char **errmsg)
msg_grid_validate();
}
-static void did_set_spellfile(char **varp, char **errmsg)
+static void did_set_spellfile(char **varp, const char **errmsg)
{
// When there is a window for this buffer in which 'spell'
// is set load the wordlists.
@@ -1136,7 +1138,7 @@ static void did_set_spellfile(char **varp, char **errmsg)
}
}
-static void did_set_spell(char **varp, char **errmsg)
+static void did_set_spell(char **varp, const char **errmsg)
{
// When there is a window for this buffer in which 'spell'
// is set load the wordlists.
@@ -1147,13 +1149,13 @@ static void did_set_spell(char **varp, char **errmsg)
}
}
-static void did_set_spellcapcheck(win_T *win, char **errmsg)
+static void did_set_spellcapcheck(win_T *win, const char **errmsg)
{
// When 'spellcapcheck' is set compile the regexp program.
*errmsg = compile_cap_prog(win->w_s);
}
-static void did_set_spelloptions(win_T *win, char **errmsg)
+static void did_set_spelloptions(win_T *win, const char **errmsg)
{
if (opt_strings_flags(win->w_s->b_p_spo, p_spo_values, &(win->w_s->b_p_spo_flags),
true) != OK) {
@@ -1161,21 +1163,21 @@ static void did_set_spelloptions(win_T *win, char **errmsg)
}
}
-static void did_set_spellsuggest(char **errmsg)
+static void did_set_spellsuggest(const char **errmsg)
{
if (spell_check_sps() != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_mkspellmem(char **errmsg)
+static void did_set_mkspellmem(const char **errmsg)
{
if (spell_check_msm() != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg)
+static void did_set_buftype(buf_T *buf, win_T *win, const char **errmsg)
{
// When 'buftype' is set, check for valid value.
if ((buf->terminal && buf->b_p_bt[0] != 't')
@@ -1193,7 +1195,7 @@ static void did_set_buftype(buf_T *buf, win_T *win, char **errmsg)
}
// 'statusline', 'winbar', 'tabline', 'rulerformat' or 'statuscolumn'
-static void did_set_statusline(win_T *win, char **varp, char **gvarp, char **errmsg)
+static void did_set_statusline(win_T *win, char **varp, char **gvarp, const char **errmsg)
{
if (varp == &p_ruf) { // reset ru_wid first
ru_wid = 0;
@@ -1227,7 +1229,7 @@ static void did_set_statusline(win_T *win, char **varp, char **gvarp, char **err
}
}
-static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, char **errmsg)
+static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, const char **errmsg)
{
// check if it is a valid value for 'complete' -- Acevedo
for (char *s = *varp; *s;) {
@@ -1265,7 +1267,7 @@ static void did_set_complete(char **varp, char *errbuf, size_t errbuflen, char *
}
}
-static void did_set_completeopt(char **errmsg)
+static void did_set_completeopt(const char **errmsg)
{
if (check_opt_strings(p_cot, p_cot_values, true) != OK) {
*errmsg = e_invarg;
@@ -1275,7 +1277,7 @@ static void did_set_completeopt(char **errmsg)
}
#ifdef BACKSLASH_IN_FILENAME
-static void did_set_completeslash(buf_T *buf, char **errmsg)
+static void did_set_completeslash(buf_T *buf, const char **errmsg)
{
if (check_opt_strings(p_csl, p_csl_values, false) != OK
|| check_opt_strings(buf->b_p_csl, p_csl_values, false) != OK) {
@@ -1284,7 +1286,7 @@ static void did_set_completeslash(buf_T *buf, char **errmsg)
}
#endif
-static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, char **errmsg)
+static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, const char **errmsg)
{
if (check_signcolumn(*varp) != OK) {
*errmsg = e_invarg;
@@ -1298,14 +1300,14 @@ static void did_set_signcolumn(win_T *win, char **varp, const char *oldval, char
}
}
-static void did_set_foldcolumn(char **varp, char **errmsg)
+static void did_set_foldcolumn(char **varp, const char **errmsg)
{
if (**varp == NUL || check_opt_strings(*varp, p_fdc_values, false) != OK) {
*errmsg = e_invarg;
}
}
-static void did_set_backspace(char **errmsg)
+static void did_set_backspace(const char **errmsg)
{
if (ascii_isdigit(*p_bs)) {
if (*p_bs > '3' || p_bs[1] != NUL) {
@@ -1316,7 +1318,7 @@ static void did_set_backspace(char **errmsg)
}
}
-static void did_set_tagcase(buf_T *buf, int opt_flags, char **errmsg)
+static void did_set_tagcase(buf_T *buf, int opt_flags, const char **errmsg)
{
unsigned int *flags;
char *p;
@@ -1338,14 +1340,14 @@ static void did_set_tagcase(buf_T *buf, int opt_flags, char **errmsg)
}
}
-static void did_set_diffopt(char **errmsg)
+static void did_set_diffopt(const char **errmsg)
{
if (diffopt_changed() == FAIL) {
*errmsg = e_invarg;
}
}
-static void did_set_foldmethod(win_T *win, char **varp, char **errmsg)
+static void did_set_foldmethod(win_T *win, char **varp, const char **errmsg)
{
if (check_opt_strings(*varp, p_fdm_values, false) != OK
|| *win->w_p_fdm == NUL) {
@@ -1358,7 +1360,7 @@ static void did_set_foldmethod(win_T *win, char **varp, char **errmsg)
}
}
-static void did_set_foldmarker(win_T *win, char **varp, char **errmsg)
+static void did_set_foldmarker(win_T *win, char **varp, const char **errmsg)
{
char *p = vim_strchr(*varp, ',');
if (p == NULL) {
@@ -1370,7 +1372,7 @@ static void did_set_foldmarker(win_T *win, char **varp, char **errmsg)
}
}
-static void did_set_commentstring(char **varp, char **errmsg)
+static void did_set_commentstring(char **varp, const char **errmsg)
{
if (**varp != NUL && strstr(*varp, "%s") == NULL) {
*errmsg = N_("E537: 'commentstring' must be empty or contain %s");
@@ -1384,7 +1386,7 @@ static void did_set_foldignore(win_T *win)
}
}
-static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **errmsg)
+static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, const char **errmsg)
{
char *ve = p_ve;
unsigned int *flags = &ve_flags;
@@ -1410,7 +1412,7 @@ static void did_set_virtualedit(win_T *win, int opt_flags, char *oldval, char **
}
}
-static void did_set_lispoptions(char **varp, char **errmsg)
+static void did_set_lispoptions(char **varp, const char **errmsg)
{
if (**varp != NUL && strcmp(*varp, "expr:0") != 0 && strcmp(*varp, "expr:1") != 0) {
*errmsg = e_invarg;
@@ -1418,7 +1420,7 @@ static void did_set_lispoptions(char **varp, char **errmsg)
}
static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_checked,
- bool *value_changed, char **errmsg)
+ bool *value_changed, const char **errmsg)
{
if (!valid_filetype(*varp)) {
*errmsg = e_invarg;
@@ -1432,14 +1434,14 @@ static void did_set_filetype_or_syntax(char **varp, char *oldval, int *value_che
*value_checked = true;
}
-static void did_set_winhl(win_T *win, char **errmsg)
+static void did_set_winhl(win_T *win, const char **errmsg)
{
if (!parse_winhl_opt(win)) {
*errmsg = e_invarg;
}
}
-static void did_set_varsoftabstop(buf_T *buf, char **varp, char **errmsg)
+static void did_set_varsoftabstop(buf_T *buf, char **varp, const char **errmsg)
{
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(buf->b_p_vsts_array);
@@ -1465,7 +1467,7 @@ static void did_set_varsoftabstop(buf_T *buf, char **varp, char **errmsg)
}
}
-static void did_set_vartabstop(buf_T *buf, win_T *win, char **varp, char **errmsg)
+static void did_set_vartabstop(buf_T *buf, win_T *win, char **varp, const char **errmsg)
{
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
XFREE_CLEAR(buf->b_p_vts_array);
@@ -1505,7 +1507,7 @@ static void did_set_optexpr(char **varp)
// handle option that is a list of flags.
static void did_set_option_listflag(char **varp, char *flags, char *errbuf, size_t errbuflen,
- char **errmsg)
+ const char **errmsg)
{
for (char *s = *varp; *s; s++) {
if (vim_strchr(flags, (uint8_t)(*s)) == NULL) {
@@ -1569,11 +1571,11 @@ static void do_spelllang_source(win_T *win)
/// @param value_checked value was checked to be safe, no need to set P_INSECURE
///
/// @return NULL for success, or an untranslated error message for an error
-static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char **varp,
- char *oldval, char *errbuf, size_t errbuflen, int opt_flags,
- int *value_checked)
+static const char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char **varp,
+ char *oldval, char *errbuf, size_t errbuflen,
+ int opt_flags, int *value_checked)
{
- char *errmsg = NULL;
+ const char *errmsg = NULL;
bool did_chartab = false;
vimoption_T *opt = get_option(opt_idx);
bool free_oldval = (opt->flags & P_ALLOCED);
@@ -1881,8 +1883,8 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
return errmsg;
}
-char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf, size_t errbuflen,
- int opt_flags, int *value_checked)
+const char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf,
+ size_t errbuflen, int opt_flags, int *value_checked)
{
return did_set_string_option_for(curbuf, curwin, opt_idx, varp, oldval, errbuf, errbuflen,
opt_flags, value_checked);
@@ -1939,8 +1941,10 @@ int check_ff_value(char *p)
return check_opt_strings(p, p_ff_values, false);
}
-static char e_conflicts_with_value_of_listchars[] = N_("E834: Conflicts with value of 'listchars'");
-static char e_conflicts_with_value_of_fillchars[] = N_("E835: Conflicts with value of 'fillchars'");
+static const char e_conflicts_with_value_of_listchars[]
+ = N_("E834: Conflicts with value of 'listchars'");
+static const char e_conflicts_with_value_of_fillchars[]
+ = N_("E835: Conflicts with value of 'fillchars'");
/// Calls mb_cptr2char_adv(p) and returns the character.
/// If "p" starts with "\x", "\u" or "\U" the hex or unicode value is used.
@@ -1978,7 +1982,7 @@ static int get_encoded_char_adv(const char **p)
/// @param varp either the global or the window-local value.
/// @param apply if false, do not store the flags, only check for errors.
/// @return error message, NULL if it's OK.
-char *set_chars_option(win_T *wp, char **varp, bool apply)
+const char *set_chars_option(win_T *wp, char **varp, bool apply)
{
const char *last_multispace = NULL; // Last occurrence of "multispace:"
const char *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
@@ -2202,7 +2206,7 @@ char *set_chars_option(win_T *wp, char **varp, bool apply)
/// May set different defaults in case character widths change.
///
/// @return an untranslated error message if any of them is invalid, NULL otherwise.
-char *check_chars_options(void)
+const char *check_chars_options(void)
{
if (set_chars_option(curwin, &p_lcs, false) != NULL) {
return e_conflicts_with_value_of_listchars;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 9f6181f986..c17a6366fe 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -244,10 +244,10 @@ typedef struct vgr_args_S {
# include "quickfix.c.generated.h"
#endif
-static char *e_no_more_items = N_("E553: No more items");
-static char *e_current_quickfix_list_was_changed =
+static const char *e_no_more_items = N_("E553: No more items");
+static const char *e_current_quickfix_list_was_changed =
N_("E925: Current quickfix list was changed");
-static char *e_current_location_list_was_changed =
+static const char *e_current_location_list_was_changed =
N_("E926: Current location list was changed");
// Quickfix window check helper macro
@@ -2385,7 +2385,7 @@ static qfline_T *get_nth_valid_entry(qf_list_T *qfl, int errornr, int dir, int *
{
qfline_T *qf_ptr = qfl->qf_ptr;
int qf_idx = qfl->qf_index;
- char *err = e_no_more_items;
+ const char *err = e_no_more_items;
while (errornr--) {
qfline_T *prev_qf_ptr = qf_ptr;
@@ -3885,7 +3885,7 @@ static buf_T *qf_find_buf(qf_info_T *qi)
}
/// Process the 'quickfixtextfunc' option value.
-void qf_process_qftf_option(char **errmsg)
+void qf_process_qftf_option(const char **errmsg)
{
if (option_set_callback_func(p_qftf, &qftf_cb) == FAIL) {
*errmsg = e_invarg;
@@ -7304,7 +7304,7 @@ void f_getqflist(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
FUNC_ATTR_NONNULL_ARG(2, 3)
{
- static char *e_invact = N_("E927: Invalid action: '%s'");
+ static const char *e_invact = N_("E927: Invalid action: '%s'");
const char *title = NULL;
char action = ' ';
static int recursive = 0;
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 0b9a9bbdec..4e3a78f10e 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -104,24 +104,24 @@ static int toggle_Magic(int x)
#define MAX_LIMIT (32767L << 16L)
-static char e_missingbracket[] = N_("E769: Missing ] after %s[");
-static char e_reverse_range[] = N_("E944: Reverse range in character class");
-static char e_large_class[] = N_("E945: Range too large in character class");
-static char e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
-static char e_unmatchedp[] = N_("E54: Unmatched %s(");
-static char e_unmatchedpar[] = N_("E55: Unmatched %s)");
-static char e_z_not_allowed[] = N_("E66: \\z( not allowed here");
-static char e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
-static char e_missing_sb[] = N_("E69: Missing ] after %s%%[");
-static char e_empty_sb[] = N_("E70: Empty %s%%[]");
-static char e_recursive[] = N_("E956: Cannot use pattern recursively");
-static char e_regexp_number_after_dot_pos_search_chr[]
+static const char e_missingbracket[] = N_("E769: Missing ] after %s[");
+static const char e_reverse_range[] = N_("E944: Reverse range in character class");
+static const char e_large_class[] = N_("E945: Range too large in character class");
+static const char e_unmatchedpp[] = N_("E53: Unmatched %s%%(");
+static const char e_unmatchedp[] = N_("E54: Unmatched %s(");
+static const char e_unmatchedpar[] = N_("E55: Unmatched %s)");
+static const char e_z_not_allowed[] = N_("E66: \\z( not allowed here");
+static const char e_z1_not_allowed[] = N_("E67: \\z1 - \\z9 not allowed here");
+static const char e_missing_sb[] = N_("E69: Missing ] after %s%%[");
+static const char e_empty_sb[] = N_("E70: Empty %s%%[]");
+static const char e_recursive[] = N_("E956: Cannot use pattern recursively");
+static const char e_regexp_number_after_dot_pos_search_chr[]
= N_("E1204: No Number allowed after .: '\\%%%c'");
-static char e_nfa_regexp_missing_value_in_chr[]
+static const char e_nfa_regexp_missing_value_in_chr[]
= N_("E1273: (NFA regexp) missing value in '\\%%%c'");
-static char e_atom_engine_must_be_at_start_of_pattern[]
+static const char e_atom_engine_must_be_at_start_of_pattern[]
= N_("E1281: Atom '\\%%#=%c' must be at the start of the pattern");
-static char e_substitute_nesting_too_deep[] = N_("E1290: substitute nesting too deep");
+static const char e_substitute_nesting_too_deep[] = N_("E1290: substitute nesting too deep");
#define NOT_MULTI 0
#define MULTI_ONE 1
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 950814880b..b02c38fb6c 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -244,10 +244,10 @@ static int nfa_classcodes[] = {
NFA_UPPER, NFA_NUPPER
};
-static char e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
-static char e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
-static char e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %" PRId64);
-static char e_value_too_large[] = N_("E951: \\% value too large");
+static const char e_nul_found[] = N_("E865: (NFA) Regexp end encountered prematurely");
+static const char e_misplaced[] = N_("E866: (NFA regexp) Misplaced %c");
+static const char e_ill_char_class[] = N_("E877: (NFA regexp) Invalid character class: %" PRId64);
+static const char e_value_too_large[] = N_("E951: \\% value too large");
// Since the out pointers in the list are always
// uninitialized, we use the pointers themselves
@@ -1918,7 +1918,7 @@ static int nfa_regatom(void)
case Magic('|'):
case Magic('&'):
case Magic(')'):
- semsg(_(e_misplaced), (int64_t)no_Magic(c)); // -V1037
+ semsg(_(e_misplaced), (char)no_Magic(c)); // -V1037
return FAIL;
case Magic('='):
@@ -1928,7 +1928,7 @@ static int nfa_regatom(void)
case Magic('*'):
case Magic('{'):
// these should follow an atom, not form an atom
- semsg(_(e_misplaced), (int64_t)no_Magic(c));
+ semsg(_(e_misplaced), (char)no_Magic(c));
return FAIL;
case Magic('~'): {
@@ -3274,7 +3274,7 @@ static void nfa_set_code(int c)
}
static FILE *log_fd;
-static uint8_t e_log_open_failed[] =
+static const uint8_t e_log_open_failed[] =
N_("Could not open temporary log file for writing, displaying on stderr... ");
// Print the postfix notation of the current regexp.
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 9108059b4d..6623ba47af 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -3619,9 +3619,9 @@ bool valid_spellfile(const char *val)
return true;
}
-char *did_set_spell_option(bool is_spellfile)
+const char *did_set_spell_option(bool is_spellfile)
{
- char *errmsg = NULL;
+ const char *errmsg = NULL;
if (is_spellfile) {
int l = (int)strlen(curwin->w_s->b_p_spf);
@@ -3646,7 +3646,7 @@ char *did_set_spell_option(bool is_spellfile)
/// Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
/// Return error message when failed, NULL when OK.
-char *compile_cap_prog(synblock_T *synblock)
+const char *compile_cap_prog(synblock_T *synblock)
FUNC_ATTR_NONNULL_ALL
{
regprog_T *rp = synblock->b_cap_prog;
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index aa76dcbd32..b5e0698240 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -322,11 +322,11 @@ enum {
CF_UPPER = 0x02,
};
-static char *e_spell_trunc = N_("E758: Truncated spell file");
-static char *e_illegal_character_in_word = N_("E1280: Illegal character in word");
-static char *e_afftrailing = N_("Trailing text in %s line %d: %s");
-static char *e_affname = N_("Affix name too long in %s line %d: %s");
-static char *msg_compressing = N_("Compressing word tree...");
+static const char *e_spell_trunc = N_("E758: Truncated spell file");
+static const char *e_illegal_character_in_word = N_("E1280: Illegal character in word");
+static const char *e_afftrailing = N_("Trailing text in %s line %d: %s");
+static const char *e_affname = N_("Affix name too long in %s line %d: %s");
+static const char *msg_compressing = N_("Compressing word tree...");
#define MAXLINELEN 500 // Maximum length in bytes of a line in a .aff
// and .dic file.
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 14fef19399..c0bb7d726e 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -58,7 +58,7 @@ static bool did_syntax_onoff = false;
#define SPO_LC_OFF 6 // leading context offset
#define SPO_COUNT 7
-static char e_illegal_arg[] = N_("E390: Illegal argument: %s");
+static const char e_illegal_arg[] = N_("E390: Illegal argument: %s");
// The patterns that are being searched for are stored in a syn_pattern.
// A match item consists of one pattern.
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 2d9d0de951..a9ef884214 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -188,11 +188,11 @@ typedef struct {
# include "tag.c.generated.h"
#endif
-static char *bottommsg = N_("E555: at bottom of tag stack");
-static char *topmsg = N_("E556: at top of tag stack");
-static char *recurmsg = N_("E986: cannot modify the tag stack within tagfunc");
-static char *tfu_inv_ret_msg = N_("E987: invalid return value from tagfunc");
-static char e_window_unexpectedly_close_while_searching_for_tags[]
+static const char *bottommsg = N_("E555: at bottom of tag stack");
+static const char *topmsg = N_("E556: at top of tag stack");
+static const char *recurmsg = N_("E986: cannot modify the tag stack within tagfunc");
+static const char *tfu_inv_ret_msg = N_("E987: invalid return value from tagfunc");
+static const char e_window_unexpectedly_close_while_searching_for_tags[]
= N_("E1299: Window unexpectedly closed while searching for tags");
static char *tagmatchname = NULL; // name of last used tag
@@ -210,7 +210,7 @@ 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.
-void set_tagfunc_option(char **errmsg)
+void set_tagfunc_option(const char **errmsg)
{
callback_free(&tfu_cb);
callback_free(&curbuf->b_tfu_cb);
diff --git a/src/nvim/testing.c b/src/nvim/testing.c
index 3569856f2c..2b5284e15e 100644
--- a/src/nvim/testing.c
+++ b/src/nvim/testing.c
@@ -34,13 +34,13 @@
# include "testing.c.generated.h"
#endif
-static char e_assert_fails_second_arg[]
+static const char e_assert_fails_second_arg[]
= N_("E856: assert_fails() second argument must be a string or a list with one or two strings");
-static char e_assert_fails_fourth_argument[]
+static const char e_assert_fails_fourth_argument[]
= N_("E1115: assert_fails() fourth argument must be a number");
-static char e_assert_fails_fifth_argument[]
+static const char e_assert_fails_fifth_argument[]
= N_("E1116: assert_fails() fifth argument must be a string");
-static char e_calling_test_garbagecollect_now_while_v_testing_is_not_set[]
+static const char e_calling_test_garbagecollect_now_while_v_testing_is_not_set[]
= N_("E1142: Calling test_garbagecollect_now() while v:testing is not set");
/// Prepare "gap" for an assert error and add the sourcing position.
@@ -507,7 +507,7 @@ void f_assert_fails(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
garray_T ga;
int save_trylevel = trylevel;
const int called_emsg_before = called_emsg;
- char *wrong_arg_msg = NULL;
+ const char *wrong_arg_msg = NULL;
// trylevel must be zero for a ":throw" command to be considered failed
trylevel = 0;
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index ad33ba4667..873970fc39 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -624,7 +624,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
// extra fields for uhp
#define UHP_SAVE_NR 1
-static char e_not_open[] = N_("E828: Cannot open undo file for writing: %s");
+static const char e_not_open[] = N_("E828: Cannot open undo file for writing: %s");
/// Compute the hash for a buffer text into hash[UNDO_HASH_SIZE].
///
diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c
index 6869f7eaf9..b58ccc809b 100644
--- a/src/nvim/usercmd.c
+++ b/src/nvim/usercmd.c
@@ -44,11 +44,11 @@
garray_T ucmds = { 0, 0, sizeof(ucmd_T), 4, NULL };
-static char e_complete_used_without_allowing_arguments[]
+static const char e_complete_used_without_allowing_arguments[]
= N_("E1208: -complete used without allowing arguments");
-static char e_no_such_user_defined_command_str[]
+static const char e_no_such_user_defined_command_str[]
= N_("E184: No such user-defined command: %s");
-static char e_no_such_user_defined_command_in_current_buffer_str[]
+static const char e_no_such_user_defined_command_in_current_buffer_str[]
= N_("E1237: No such user-defined command in current buffer: %s");
/// List of names for completion for ":command" with the EXPAND_ flag.
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 48663c5a20..b41d054ac3 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -96,7 +96,7 @@ typedef enum {
WEE_TRIGGER_LEAVE_AUTOCMDS = 0x10,
} wee_flags_T;
-static char e_cannot_split_window_when_closing_buffer[]
+static const char e_cannot_split_window_when_closing_buffer[]
= N_("E1159: Cannot split a window when closing the buffer");
static char *m_onlyone = N_("Already only one window");
@@ -7422,7 +7422,7 @@ static int int_cmp(const void *a, const void *b)
/// Handle setting 'colorcolumn' or 'textwidth' in window "wp".
///
/// @return error message, NULL if it's OK.
-char *check_colorcolumn(win_T *wp)
+const char *check_colorcolumn(win_T *wp)
{
if (wp->w_buffer == NULL) {
return NULL; // buffer was closed