diff options
author | Michael Reed <m.reed@mykolab.com> | 2015-05-13 15:31:40 -0400 |
---|---|---|
committer | Michael Reed <m.reed@mykolab.com> | 2015-05-13 15:31:40 -0400 |
commit | e888c479f3d34a1948c63495328b4184ff2ab874 (patch) | |
tree | f7dfab3c160479dd7170fbdb47684c6fd9188f4e /src | |
parent | af4b0a76a757f44ea7fbfc8e1c863952adc6ac1e (diff) | |
parent | af3381b3196107653c04b56e7fae07e8a9a320ed (diff) | |
download | rneovim-e888c479f3d34a1948c63495328b4184ff2ab874.tar.gz rneovim-e888c479f3d34a1948c63495328b4184ff2ab874.tar.bz2 rneovim-e888c479f3d34a1948c63495328b4184ff2ab874.zip |
Merge pull request #2619 from Pyrohh/char_u-to-char
[RDY] Remove char_u (6)
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 6 | ||||
-rw-r--r-- | src/nvim/buffer.c | 6 | ||||
-rw-r--r-- | src/nvim/diff.c | 6 | ||||
-rw-r--r-- | src/nvim/digraph.c | 2 | ||||
-rw-r--r-- | src/nvim/edit.c | 6 | ||||
-rw-r--r-- | src/nvim/eval.c | 10 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 28 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 44 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 78 | ||||
-rw-r--r-- | src/nvim/ex_eval.c | 28 | ||||
-rw-r--r-- | src/nvim/farsi.c | 10 | ||||
-rw-r--r-- | src/nvim/file_search.c | 14 | ||||
-rw-r--r-- | src/nvim/fileio.c | 7 | ||||
-rw-r--r-- | src/nvim/if_cscope.c | 12 | ||||
-rw-r--r-- | src/nvim/main.c | 104 | ||||
-rw-r--r-- | src/nvim/memline.c | 4 | ||||
-rw-r--r-- | src/nvim/memory.c | 24 | ||||
-rw-r--r-- | src/nvim/message.c | 8 | ||||
-rw-r--r-- | src/nvim/misc1.c | 3 | ||||
-rw-r--r-- | src/nvim/misc2.c | 4 | ||||
-rw-r--r-- | src/nvim/normal.c | 14 | ||||
-rw-r--r-- | src/nvim/ops.c | 10 | ||||
-rw-r--r-- | src/nvim/os/fs.c | 2 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 4 | ||||
-rw-r--r-- | src/nvim/regexp.c | 2 | ||||
-rw-r--r-- | src/nvim/search.c | 2 | ||||
-rw-r--r-- | src/nvim/spell.c | 205 | ||||
-rw-r--r-- | src/nvim/syntax.c | 8 | ||||
-rw-r--r-- | src/nvim/tag.c | 8 | ||||
-rw-r--r-- | src/nvim/terminal.c | 2 | ||||
-rw-r--r-- | src/nvim/undo.c | 31 | ||||
-rw-r--r-- | src/nvim/window.c | 20 |
32 files changed, 341 insertions, 371 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 1204c9e1d1..22bdbc2ee5 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -41,7 +41,7 @@ void vim_command(String str, Error *err) { // Run the command try_start(); - do_cmdline_cmd((char_u *) str.data); + do_cmdline_cmd(str.data); update_screen(VALID); try_end(err); } @@ -124,9 +124,9 @@ String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, String vim_command_output(String str, Error *err) { - do_cmdline_cmd((char_u *)"redir => v:command_output"); + do_cmdline_cmd("redir => v:command_output"); vim_command(str, err); - do_cmdline_cmd((char_u *)"redir END"); + do_cmdline_cmd("redir END"); if (err->set) { return (String) STRING_INIT; diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 094e80086c..fd55e8c7a0 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -778,17 +778,17 @@ do_bufdel ( if (deleted == 1) MSG(_("1 buffer unloaded")); else - smsg((char_u *)_("%d buffers unloaded"), deleted); + smsg(_("%d buffers unloaded"), deleted); } else if (command == DOBUF_DEL) { if (deleted == 1) MSG(_("1 buffer deleted")); else - smsg((char_u *)_("%d buffers deleted"), deleted); + smsg(_("%d buffers deleted"), deleted); } else { if (deleted == 1) MSG(_("1 buffer wiped out")); else - smsg((char_u *)_("%d buffers wiped out"), deleted); + smsg(_("%d buffers wiped out"), deleted); } } } diff --git a/src/nvim/diff.c b/src/nvim/diff.c index b21bc1f2f4..7c1a9de623 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -978,7 +978,7 @@ void ex_diffpatch(exarg_T *eap) // Do filetype detection with the new name. if (au_has_group((char_u *)"filetypedetect")) { - do_cmdline_cmd((char_u *)":doau filetypedetect BufRead"); + do_cmdline_cmd(":doau filetypedetect BufRead"); } } } @@ -1087,7 +1087,7 @@ void diff_win_options(win_T *wp, int addbuf) // make sure topline is not halfway through a fold changed_window_setting_win(wp); if (vim_strchr(p_sbo, 'h') == NULL) { - do_cmdline_cmd((char_u *)"set sbo+=hor"); + do_cmdline_cmd("set sbo+=hor"); } // Saved the current values, to be restored in ex_diffoff(). @@ -1173,7 +1173,7 @@ void ex_diffoff(exarg_T *eap) // Remove "hor" from from 'scrollopt' if there are no diff windows left. if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) { - do_cmdline_cmd((char_u *)"set sbo-=hor"); + do_cmdline_cmd("set sbo-=hor"); } } diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index 63329c878c..9525024c1b 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -1743,7 +1743,7 @@ char_u* keymap_init(void) // Stop any active keymap and clear the table. Also remove // b:keymap_name, as no keymap is active now. keymap_unload(); - do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); + do_cmdline_cmd("unlet! b:keymap_name"); } else { char *buf; size_t buflen; diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 674d4aa512..682a9146f3 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -1049,9 +1049,9 @@ doESCkey: * cursor. */ if (bt_quickfix(curbuf) && c == CAR) { if (curwin->w_llist_ref == NULL) /* quickfix window */ - do_cmdline_cmd((char_u *)".cc"); + do_cmdline_cmd(".cc"); else /* location list window */ - do_cmdline_cmd((char_u *)".ll"); + do_cmdline_cmd(".ll"); break; } if (cmdwin_type != 0) { @@ -2342,7 +2342,7 @@ void ins_compl_show_pum(void) return; /* Dirty hard-coded hack: remove any matchparen highlighting. */ - do_cmdline_cmd((char_u *)"if exists('g:loaded_matchparen')|3match none|endif"); + do_cmdline_cmd("if exists('g:loaded_matchparen')|3match none|endif"); /* Update the screen before drawing the popup menu over it. */ update_screen(0); diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d6b1960155..906659a1f3 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19105,7 +19105,7 @@ call_user_func ( ++no_wait_return; verbose_enter_scroll(); - smsg((char_u *)_("calling %s"), sourcing_name); + smsg(_("calling %s"), sourcing_name); if (p_verbose >= 14) { char_u buf[MSG_BUF_LEN]; char_u numbuf2[NUMBUFLEN]; @@ -19203,9 +19203,9 @@ call_user_func ( verbose_enter_scroll(); if (aborting()) - smsg((char_u *)_("%s aborted"), sourcing_name); + smsg(_("%s aborted"), sourcing_name); else if (fc->rettv->v_type == VAR_NUMBER) - smsg((char_u *)_("%s returning #%" PRId64 ""), + smsg(_("%s returning #%" PRId64 ""), sourcing_name, (int64_t)fc->rettv->vval.v_number); else { char_u buf[MSG_BUF_LEN]; @@ -19224,7 +19224,7 @@ call_user_func ( trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); s = buf; } - smsg((char_u *)_("%s returning %s"), sourcing_name, s); + smsg(_("%s returning %s"), sourcing_name, s); xfree(tofree); } } @@ -19245,7 +19245,7 @@ call_user_func ( ++no_wait_return; verbose_enter_scroll(); - smsg((char_u *)_("continuing in %s"), sourcing_name); + smsg(_("continuing in %s"), sourcing_name); msg_puts((char_u *)"\n"); /* don't overwrite this either */ verbose_leave_scroll(); diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 8cfb2ce2a0..824cc125f4 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -748,7 +748,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest) if (num_lines == 1) MSG(_("1 line moved")); else - smsg((char_u *)_("%" PRId64 " lines moved"), (int64_t)num_lines); + smsg(_("%" PRId64 " lines moved"), (int64_t)num_lines); } /* @@ -1439,7 +1439,7 @@ read_viminfo ( if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"), + smsg(_("Reading viminfo file \"%s\"%s%s%s"), fname, (flags & VIF_WANT_INFO) ? _(" info") : "", (flags & VIF_WANT_MARKS) ? _(" marks") : "", @@ -1616,7 +1616,7 @@ void write_viminfo(char_u *file, int forceit) if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Writing viminfo file \"%s\""), fname); + smsg(_("Writing viminfo file \"%s\""), fname); verbose_leave(); } @@ -3899,7 +3899,7 @@ void do_sub(exarg_T *eap) /* write message same highlighting as for * wait_return */ smsg_attr(hl_attr(HLF_R), - (char_u *)_("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); + _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); msg_no_more = FALSE; msg_scroll = i; showruler(TRUE); @@ -4440,9 +4440,9 @@ void ex_global(exarg_T *eap) MSG(_(e_interr)); else if (ndone == 0) { if (type == 'v') - smsg((char_u *)_("Pattern found in every line: %s"), pat); + smsg(_("Pattern found in every line: %s"), pat); else - smsg((char_u *)_("Pattern not found: %s"), pat); + smsg(_("Pattern not found: %s"), pat); } else global_exe(cmd); @@ -4682,7 +4682,7 @@ void ex_help(exarg_T *eap) * Try to open the file specified by the "helpfile" option. */ if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) { - smsg((char_u *)_("Sorry, help file \"%s\" not found"), p_hf); + smsg(_("Sorry, help file \"%s\" not found"), p_hf); goto erret; } fclose(helpfd); @@ -5252,7 +5252,7 @@ void fix_help_buffer(void) */ void ex_exusage(exarg_T *eap) { - do_cmdline_cmd((char_u *)"help ex-cmd-index"); + do_cmdline_cmd("help ex-cmd-index"); } /* @@ -5260,7 +5260,7 @@ void ex_exusage(exarg_T *eap) */ void ex_viusage(exarg_T *eap) { - do_cmdline_cmd((char_u *)"help normal-index"); + do_cmdline_cmd("help normal-index"); } @@ -5973,11 +5973,9 @@ void ex_sign(exarg_T *eap) beginline(BL_WHITE); } else - { /* ... not currently in a window */ - char_u *cmd; - - cmd = xmalloc(STRLEN(buf->b_fname) + 25); - sprintf((char *)cmd, "e +%" PRId64 " %s", + { // ... not currently in a window + char *cmd = xmalloc(STRLEN(buf->b_fname) + 25); + sprintf(cmd, "e +%" PRId64 " %s", (int64_t)lnum, buf->b_fname); do_cmdline_cmd(cmd); xfree(cmd); @@ -6040,7 +6038,7 @@ static void sign_list_defined(sign_T *sp) { char_u *p; - smsg((char_u *)"sign %s", sp->sn_name); + smsg("sign %s", sp->sn_name); if (sp->sn_icon != NULL) { MSG_PUTS(" icon="); msg_outtrans(sp->sn_icon); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 08d84c2440..3fe4acc471 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -169,9 +169,9 @@ void do_debug(char_u *cmd) if (sourcing_name != NULL) msg(sourcing_name); if (sourcing_lnum != 0) - smsg((char_u *)_("line %" PRId64 ": %s"), (int64_t)sourcing_lnum, cmd); + smsg(_("line %" PRId64 ": %s"), (int64_t)sourcing_lnum, cmd); else - smsg((char_u *)_("cmd: %s"), cmd); + smsg(_("cmd: %s"), cmd); /* * Repeat getting a command and executing it. @@ -310,7 +310,7 @@ void ex_debug(exarg_T *eap) int debug_break_level_save = debug_break_level; debug_break_level = 9999; - do_cmdline_cmd(eap->arg); + do_cmdline_cmd((char *)eap->arg); debug_break_level = debug_break_level_save; } @@ -348,7 +348,7 @@ void dbg_check_breakpoint(exarg_T *eap) p = (char_u *)"<SNR>"; else p = (char_u *)""; - smsg((char_u *)_("Breakpoint in \"%s%s\" line %" PRId64), + smsg(_("Breakpoint in \"%s%s\" line %" PRId64), p, debug_breakpoint_name + (*p == NUL ? 0 : 3), (int64_t)debug_breakpoint_lnum); @@ -637,7 +637,7 @@ void ex_breaklist(exarg_T *eap) bp = &BREAKP(i); if (bp->dbg_type == DBG_FILE) home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("%3d %s %s line %" PRId64), + smsg(_("%3d %s %s line %" PRId64), bp->dbg_nr, bp->dbg_type == DBG_FUNC ? "func" : "file", bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff, @@ -2025,14 +2025,13 @@ void ex_compiler(exarg_T *eap) if (*eap->arg == NUL) { /* List all compiler scripts. */ - do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); + do_cmdline_cmd("echo globpath(&rtp, 'compiler/*.vim')"); /* ) keep the indenter happy... */ } else { buf = xmalloc(STRLEN(eap->arg) + 14); if (eap->forceit) { /* ":compiler! {name}" sets global options */ - do_cmdline_cmd((char_u *) - "command -nargs=* CompilerSet set <args>"); + do_cmdline_cmd("command -nargs=* CompilerSet set <args>"); } else { /* ":compiler! {name}" sets local options. * To remain backwards compatible "current_compiler" is always @@ -2043,8 +2042,7 @@ void ex_compiler(exarg_T *eap) old_cur_comp = get_var_value((char_u *)"g:current_compiler"); if (old_cur_comp != NULL) old_cur_comp = vim_strsave(old_cur_comp); - do_cmdline_cmd((char_u *) - "command -nargs=* CompilerSet setlocal <args>"); + do_cmdline_cmd("command -nargs=* CompilerSet setlocal <args>"); } do_unlet((char_u *)"g:current_compiler", TRUE); do_unlet((char_u *)"b:current_compiler", TRUE); @@ -2054,7 +2052,7 @@ void ex_compiler(exarg_T *eap) EMSG2(_("E666: compiler not supported: %s"), eap->arg); xfree(buf); - do_cmdline_cmd((char_u *)":delcommand CompilerSet"); + do_cmdline_cmd(":delcommand CompilerSet"); /* Set "b:current_compiler" from "current_compiler". */ p = get_var_value((char_u *)"g:current_compiler"); @@ -2129,7 +2127,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback, { if (p_verbose > 1 && name != NULL) { verbose_enter(); - smsg((char_u *)_("Searching for \"%s\" in \"%s\""), + smsg(_("Searching for \"%s\" in \"%s\""), (char *)name, (char *)p_rtp); verbose_leave(); } @@ -2157,7 +2155,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback, if (p_verbose > 2) { verbose_enter(); - smsg((char_u *)_("Searching for \"%s\""), buf); + smsg(_("Searching for \"%s\""), buf); verbose_leave(); } @@ -2180,7 +2178,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback, xfree(rtp_copy); if (p_verbose > 0 && !did_one && name != NULL) { verbose_enter(); - smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name); + smsg(_("not found in 'runtimepath': \"%s\""), name); verbose_leave(); } @@ -2318,7 +2316,7 @@ do_source ( if (fname_exp == NULL) return retval; if (os_isdir(fname_exp)) { - smsg((char_u *)_("Cannot source a directory: \"%s\""), fname); + smsg(_("Cannot source a directory: \"%s\""), fname); goto theend; } @@ -2364,9 +2362,9 @@ do_source ( if (p_verbose > 0) { verbose_enter(); if (sourcing_name == NULL) - smsg((char_u *)_("could not source \"%s\""), fname); + smsg(_("could not source \"%s\""), fname); else - smsg((char_u *)_("line %" PRId64 ": could not source \"%s\""), + smsg(_("line %" PRId64 ": could not source \"%s\""), (int64_t)sourcing_lnum, fname); verbose_leave(); } @@ -2381,9 +2379,9 @@ do_source ( if (p_verbose > 1) { verbose_enter(); if (sourcing_name == NULL) - smsg((char_u *)_("sourcing \"%s\""), fname); + smsg(_("sourcing \"%s\""), fname); else - smsg((char_u *)_("line %" PRId64 ": sourcing \"%s\""), + smsg(_("line %" PRId64 ": sourcing \"%s\""), (int64_t)sourcing_lnum, fname); verbose_leave(); } @@ -2534,9 +2532,9 @@ do_source ( sourcing_lnum = save_sourcing_lnum; if (p_verbose > 1) { verbose_enter(); - smsg((char_u *)_("finished sourcing %s"), fname); + smsg(_("finished sourcing %s"), fname); if (sourcing_name != NULL) - smsg((char_u *)_("continuing in %s"), sourcing_name); + smsg(_("continuing in %s"), sourcing_name); verbose_leave(); } @@ -2578,7 +2576,7 @@ void ex_scriptnames(exarg_T *eap) if (SCRIPT_ITEM(i).sn_name != NULL) { home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)"%3d: %s", i, NameBuff); + smsg("%3d: %s", i, NameBuff); } } @@ -3143,7 +3141,7 @@ void ex_language(exarg_T *eap) p = (char_u *)setlocale(what, NULL); if (p == NULL || *p == NUL) p = (char_u *)"Unknown"; - smsg((char_u *)_("Current %slanguage: \"%s\""), whatstr, p); + smsg(_("Current %slanguage: \"%s\""), whatstr, p); } else { #ifndef LC_MESSAGES if (what == VIM_LC_MESSAGES) diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 1b616bb579..ee935773b4 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -289,9 +289,9 @@ do_exmode ( /* * Execute a simple command line. Used for translated commands like "*". */ -int do_cmdline_cmd(char_u *cmd) +int do_cmdline_cmd(char *cmd) { - return do_cmdline(cmd, NULL, NULL, + return do_cmdline((char_u *)cmd, NULL, NULL, DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED); } @@ -604,7 +604,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, ++no_wait_return; verbose_enter_scroll(); - smsg((char_u *)_("line %" PRId64 ": %s"), + smsg(_("line %" PRId64 ": %s"), (int64_t)sourcing_lnum, cmdline_copy); if (msg_silent == 0) msg_puts((char_u *)"\n"); /* don't overwrite this */ @@ -4357,7 +4357,7 @@ static void ex_buffer(exarg_T *eap) goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2); } if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); } } } @@ -4370,7 +4370,7 @@ static void ex_bmodified(exarg_T *eap) { goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); } } @@ -4382,7 +4382,7 @@ static void ex_bnext(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); } } @@ -4396,7 +4396,7 @@ static void ex_bprevious(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); } } @@ -4410,7 +4410,7 @@ static void ex_brewind(exarg_T *eap) { goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); } } @@ -4422,7 +4422,7 @@ static void ex_blast(exarg_T *eap) { goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); if (eap->do_ecmd_cmd != NULL) { - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); } } @@ -6622,7 +6622,7 @@ do_exedit ( readonlymode = n; } else { if (eap->do_ecmd_cmd != NULL) - do_cmdline_cmd(eap->do_ecmd_cmd); + do_cmdline_cmd((char *)eap->do_ecmd_cmd); n = curwin->w_arg_idx_invalid; check_arg_idx(curwin); if (n != curwin->w_arg_idx_invalid) @@ -6901,7 +6901,7 @@ static void ex_pwd(exarg_T *eap) */ static void ex_equal(exarg_T *eap) { - smsg((char_u *)"%" PRId64, (int64_t)eap->line2); + smsg("%" PRId64, (int64_t)eap->line2); ex_may_print(eap); } @@ -7409,7 +7409,6 @@ static void ex_mkrc(exarg_T *eap) { FILE *fd; int failed = FALSE; - char_u *fname; int view_session = FALSE; int using_vdir = FALSE; /* using 'viewdir'? */ char_u *viewFile = NULL; @@ -7423,12 +7422,13 @@ static void ex_mkrc(exarg_T *eap) * short file name when 'acd' is set, that is checked later. */ did_lcd = FALSE; + char_u *fname; /* ":mkview" or ":mkview 9": generate file name with 'viewdir' */ if (eap->cmdidx == CMD_mkview && (*eap->arg == NUL || (ascii_isdigit(*eap->arg) && eap->arg[1] == NUL))) { eap->forceit = TRUE; - fname = get_view_file(*eap->arg); + fname = (char_u *)get_view_file(*eap->arg); if (fname == NULL) return; viewFile = fname; @@ -9050,48 +9050,40 @@ static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp) */ static void ex_loadview(exarg_T *eap) { - char_u *fname; - - fname = get_view_file(*eap->arg); + char *fname = get_view_file(*eap->arg); if (fname != NULL) { - if (do_source(fname, FALSE, DOSO_NONE) == FAIL) { + if (do_source((char_u *)fname, FALSE, DOSO_NONE) == FAIL) { EMSG2(_(e_notopen), fname); } xfree(fname); } } -/* - * Get the name of the view file for the current buffer. - */ -static char_u *get_view_file(int c) +/// Get the name of the view file for the current buffer. +static char *get_view_file(int c) { - int len = 0; - char_u *p, *s; - char_u *retval; - char_u *sname; - if (curbuf->b_ffname == NULL) { EMSG(_(e_noname)); return NULL; } - sname = home_replace_save(NULL, curbuf->b_ffname); + char *sname = (char *)home_replace_save(NULL, curbuf->b_ffname); - /* - * We want a file name without separators, because we're not going to make - * a directory. - * "normal" path separator -> "=+" - * "=" -> "==" - * ":" path separator -> "=-" - */ - for (p = sname; *p; ++p) - if (*p == '=' || vim_ispathsep(*p)) + // We want a file name without separators, because we're not going to make + // a directory. + // "normal" path separator -> "=+" + // "=" -> "==" + // ":" path separator -> "=-" + size_t len = 0; + for (char *p = sname; *p; p++) { + if (*p == '=' || vim_ispathsep(*p)) { ++len; - retval = xmalloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9); + } + } + char *retval = xmalloc(strlen(sname) + len + STRLEN(p_vdir) + 9); STRCPY(retval, p_vdir); - add_pathsep((char *)retval); - s = retval + STRLEN(retval); - for (p = sname; *p; ++p) { + add_pathsep(retval); + char *s = retval + strlen(retval); + for (char *p = sname; *p; p++) { if (*p == '=') { *s++ = '='; *s++ = '='; @@ -9108,7 +9100,7 @@ static char_u *get_view_file(int c) } *s++ = '='; *s++ = c; - STRCPY(s, ".vim"); + strcpy(s, ".vim"); xfree(sname); return retval; @@ -9229,7 +9221,7 @@ static void ex_filetype(exarg_T *eap) if (*eap->arg == NUL) { /* Print current status. */ - smsg((char_u *)"filetype detection:%s plugin:%s indent:%s", + smsg("filetype detection:%s plugin:%s indent:%s", filetype_detect ? "ON" : "OFF", filetype_plugin ? (filetype_detect ? "ON" : "(on)") : "OFF", filetype_indent ? (filetype_detect ? "ON" : "(on)") : "OFF"); @@ -9423,7 +9415,7 @@ static void ex_terminal(exarg_T *eap) snprintf(ex_cmd, sizeof(ex_cmd), ":enew%s | call termopen(%s%s%s) | startinsert", eap->forceit==TRUE ? "!" : "", lquote, name, rquote); - do_cmdline_cmd((uint8_t *)ex_cmd); + do_cmdline_cmd(ex_cmd); if (name != (char *)p_sh) { xfree(name); diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 224d9e9bf7..bea1aecb58 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -489,7 +489,7 @@ static int throw_exception(void *value, int type, char_u *cmdname) if (debug_break_level > 0 || *p_vfile == NUL) msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg((char_u *)_("Exception thrown: %s"), excp->value); + smsg(_("Exception thrown: %s"), excp->value); msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (debug_break_level > 0 || *p_vfile == NUL) @@ -537,10 +537,9 @@ static void discard_exception(except_T *excp, int was_finished) ++no_wait_return; if (debug_break_level > 0 || *p_vfile == NUL) msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg(was_finished - ? (char_u *)_("Exception finished: %s") - : (char_u *)_("Exception discarded: %s"), - excp->value); + smsg(was_finished ? _("Exception finished: %s") + : _("Exception discarded: %s"), + excp->value); msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (debug_break_level > 0 || *p_vfile == NUL) cmdline_row = msg_row; @@ -601,7 +600,7 @@ static void catch_exception(except_T *excp) if (debug_break_level > 0 || *p_vfile == NUL) msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg((char_u *)_("Exception caught: %s"), excp->value); + smsg(_("Exception caught: %s"), excp->value); msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (debug_break_level > 0 || *p_vfile == NUL) @@ -662,22 +661,22 @@ static void finish_exception(except_T *excp) */ static void report_pending(int action, int pending, void *value) { - char_u *mesg; - char *s; + char *mesg; + char *s; int save_msg_silent; assert(value || !(pending & CSTP_THROW)); switch (action) { case RP_MAKE: - mesg = (char_u *)_("%s made pending"); + mesg = _("%s made pending"); break; case RP_RESUME: - mesg = (char_u *)_("%s resumed"); + mesg = _("%s resumed"); break; /* case RP_DISCARD: */ default: - mesg = (char_u *)_("%s discarded"); + mesg = _("%s discarded"); break; } @@ -702,9 +701,8 @@ static void report_pending(int action, int pending, void *value) default: if (pending & CSTP_THROW) { vim_snprintf((char *)IObuff, IOSIZE, - (char *)mesg, _("Exception")); - mesg = vim_strnsave(IObuff, STRLEN(IObuff) + 4); - STRCAT(mesg, ": %s"); + mesg, _("Exception")); + mesg = (char *)concat_str(IObuff, (char_u *)": %s"); s = (char *)((except_T *)value)->value; } else if ((pending & CSTP_ERROR) && (pending & CSTP_INTERRUPT)) s = _("Error and interrupt"); @@ -719,7 +717,7 @@ static void report_pending(int action, int pending, void *value) msg_silent = FALSE; /* display messages */ ++no_wait_return; msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg(mesg, (char_u *)s); + smsg(mesg, s); msg_puts((char_u *)"\n"); /* don't overwrite this either */ cmdline_row = msg_row; --no_wait_return; diff --git a/src/nvim/farsi.c b/src/nvim/farsi.c index 80ef7cbc13..47a132c0d0 100644 --- a/src/nvim/farsi.c +++ b/src/nvim/farsi.c @@ -1588,8 +1588,8 @@ void conv_to_pvim(void) } // Following lines contains Farsi encoded character. - do_cmdline_cmd((char_u *)"%s/\202\231/\232/g"); - do_cmdline_cmd((char_u *)"%s/\201\231/\370\334/g"); + do_cmdline_cmd("%s/\202\231/\232/g"); + do_cmdline_cmd("%s/\201\231/\370\334/g"); // Assume the screen has been messed up: clear it and redraw. redraw_later(CLEAR); @@ -1603,7 +1603,7 @@ void conv_to_pstd(void) int lnum, llen, i; // Following line contains Farsi encoded character. - do_cmdline_cmd((char_u *)"%s/\232/\202\231/g"); + do_cmdline_cmd("%s/\232/\202\231/g"); for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) { ptr = ml_get((linenr_T)lnum); llen = (int)STRLEN(ptr); @@ -2044,11 +2044,11 @@ void farsi_fkey(cmdarg_T *cap) if (p_altkeymap) { if (curwin->w_farsi & W_R_L) { p_fkmap = 0; - do_cmdline_cmd((char_u *)"set norl"); + do_cmdline_cmd("set norl"); MSG(""); } else { p_fkmap = 1; - do_cmdline_cmd((char_u *)"set rl"); + do_cmdline_cmd("set rl"); MSG(""); } diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index 855de6595f..39a5ec062b 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -647,7 +647,7 @@ char_u *vim_findfile(void *search_ctx_arg) #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Already Searched: %s (%s)", + smsg("Already Searched: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -660,8 +660,8 @@ char_u *vim_findfile(void *search_ctx_arg) #ifdef FF_VERBOSE else if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Searching: %s (%s)", - stackp->ffs_fix_path, stackp->ffs_wc_path); + smsg("Searching: %s (%s)", + stackp->ffs_fix_path, stackp->ffs_wc_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); @@ -821,7 +821,7 @@ char_u *vim_findfile(void *search_ctx_arg) ) == FAIL) { if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Already: %s", + smsg("Already: %s", file_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -848,7 +848,7 @@ char_u *vim_findfile(void *search_ctx_arg) #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"HIT: %s", file_path); + smsg("HIT: %s", file_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); @@ -1011,7 +1011,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"ff_get_visited_list: FOUND list for %s", + smsg("ff_get_visited_list: FOUND list for %s", filename); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -1027,7 +1027,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l #ifdef FF_VERBOSE if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"ff_get_visited_list: new list for %s", filename); + smsg("ff_get_visited_list: new list for %s", filename); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index f5cf226da4..4dfa155e61 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -5404,8 +5404,7 @@ void aubuflocal_remove(buf_T *buf) au_remove_pat(ap); if (p_verbose >= 6) { verbose_enter(); - smsg((char_u *) - _("auto-removing autocommand: %s <buffer=%d>"), + smsg(_("auto-removing autocommand: %s <buffer=%d>"), event_nr2name(event), buf->b_fnum); verbose_leave(); } @@ -6835,7 +6834,7 @@ auto_next_pat ( (char *)name, (char *)ap->pat); if (p_verbose >= 8) { verbose_enter(); - smsg((char_u *)_("Executing %s"), sourcing_name); + smsg(_("Executing %s"), sourcing_name); verbose_leave(); } @@ -6897,7 +6896,7 @@ char_u *getnextac(int c, void *cookie, int indent) if (p_verbose >= 9) { verbose_enter_scroll(); - smsg((char_u *)_("autocommand %s"), ac->cmd); + smsg(_("autocommand %s"), ac->cmd); msg_puts((char_u *)"\n"); /* don't overwrite this either */ verbose_leave_scroll(); } diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index b5751f0a6e..407709866c 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -531,8 +531,8 @@ staterr: if (p_csverbose) { msg_clr_eos(); (void)smsg_attr(hl_attr(HLF_R), - (char_u *)_("Added cscope database %s"), - csinfo[i].fname); + _("Added cscope database %s"), + csinfo[i].fname); } } @@ -1115,7 +1115,7 @@ static int cs_help(exarg_T *eap) /* Use %*s rather than %30s to ensure proper alignment in utf-8 */ if (space_cnt < 0) space_cnt = 0; - (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"), + (void)smsg(_("%-5s: %s%*s (Usage: %s)"), cmdp->name, help, space_cnt, " ", cmdp->usage); @@ -1316,7 +1316,7 @@ cs_kill_execute ( if (p_csverbose) { msg_clr_eos(); (void)smsg_attr(hl_attr(HLF_R) | MSG_HIST, - (char_u *)_("cscope connection %s closed"), cname); + _("cscope connection %s closed"), cname); } cs_release_csp(i, TRUE); } @@ -2083,10 +2083,10 @@ static int cs_show(exarg_T *eap) continue; if (csinfo[i].ppath != NULL) - (void)smsg((char_u *)"%2d %-5ld %-34s %-32s", + (void)smsg("%2d %-5ld %-34s %-32s", i, (long)csinfo[i].pid, csinfo[i].fname, csinfo[i].ppath); else - (void)smsg((char_u *)"%2d %-5ld %-34s <none>", + (void)smsg("%2d %-5ld %-34s <none>", i, (long)csinfo[i].pid, csinfo[i].fname); } } diff --git a/src/nvim/main.c b/src/nvim/main.c index 4da654e9f4..3120caa782 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -81,13 +81,13 @@ typedef struct { int argc; char **argv; - char_u *use_vimrc; /* vimrc from -u argument */ + char *use_vimrc; // vimrc from -u argument int n_commands; /* no. of commands from + or -c */ - char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ + char *commands[MAX_ARG_CMDS]; // commands from + or -c arg char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */ int n_pre_commands; /* no. of commands from --cmd */ - char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */ + char *pre_commands[MAX_ARG_CMDS]; // commands from --cmd argument int edit_type; /* type of editing to do */ char_u *tagname; /* tag from -t argument */ @@ -286,15 +286,14 @@ int main(int argc, char **argv) } // open terminals when opening files that start with term:// - do_cmdline_cmd((uint8_t *) - "autocmd BufReadCmd term://* " - ":call termopen( " - // Capture the command string - "matchstr(expand(\"<amatch>\"), " - "'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), " - // capture the working directory - "{'cwd': get(matchlist(expand(\"<amatch>\"), " - "'\\c\\mterm://\\(.\\{-}\\)//'), 1, '')})"); + do_cmdline_cmd("autocmd BufReadCmd term://* " + ":call termopen( " + // Capture the command string + "matchstr(expand(\"<amatch>\"), " + "'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), " + // capture the working directory + "{'cwd': get(matchlist(expand(\"<amatch>\"), " + "'\\c\\mterm://\\(.\\{-}\\)//'), 1, '')})"); /* Execute --cmd arguments. */ exe_pre_commands(¶ms); @@ -872,9 +871,9 @@ static void command_line_scan(mparm_T *parmp) mainerr(ME_EXTRA_CMD, NULL); argv_idx = -1; /* skip to next argument */ if (argv[0][1] == NUL) - parmp->commands[parmp->n_commands++] = (char_u *)"$"; + parmp->commands[parmp->n_commands++] = "$"; else - parmp->commands[parmp->n_commands++] = (char_u *)&(argv[0][1]); + parmp->commands[parmp->n_commands++] = &(argv[0][1]); } /* * Optional argument. @@ -1116,7 +1115,7 @@ static void command_line_scan(mparm_T *parmp) if (argv[0][argv_idx] != NUL) { if (parmp->n_commands >= MAX_ARG_CMDS) mainerr(ME_EXTRA_CMD, NULL); - parmp->commands[parmp->n_commands++] = (char_u *)argv[0] + parmp->commands[parmp->n_commands++] = argv[0] + argv_idx; argv_idx = -1; break; @@ -1169,15 +1168,16 @@ static void command_line_scan(mparm_T *parmp) a = SESSION_FILE; ++argc; --argv; - } else + } else { a = argv[0]; - p = xmalloc(STRLEN(a) + 4); - sprintf((char *)p, "so %s", a); + } + char *s = xmalloc(STRLEN(a) + 4); + sprintf(s, "so %s", a); parmp->cmds_tofree[parmp->n_commands] = TRUE; - parmp->commands[parmp->n_commands++] = p; - } else - parmp->commands[parmp->n_commands++] = - (char_u *)argv[0]; + parmp->commands[parmp->n_commands++] = s; + } else { + parmp->commands[parmp->n_commands++] = argv[0]; + } break; case '-': @@ -1185,8 +1185,7 @@ static void command_line_scan(mparm_T *parmp) /* "--cmd {command}" execute command */ if (parmp->n_pre_commands >= MAX_ARG_CMDS) mainerr(ME_EXTRA_CMD, NULL); - parmp->pre_commands[parmp->n_pre_commands++] = - (char_u *)argv[0]; + parmp->pre_commands[parmp->n_pre_commands++] = argv[0]; } /* "--startuptime <file>" already handled */ break; @@ -1232,7 +1231,7 @@ scripterror: break; case 'u': /* "-u {vimrc}" vim inits file */ - parmp->use_vimrc = (char_u *)argv[0]; + parmp->use_vimrc = argv[0]; break; case 'U': /* "-U {gvimrc}" gvim inits file */ @@ -1376,9 +1375,9 @@ static char_u *get_fname(mparm_T *parmp) /* Temporarily add '(' and ')' to 'isfname'. These are valid * filename characters but are excluded from 'isfname' to make * "gf" work on a file name in parenthesis (e.g.: see vim.h). */ - do_cmdline_cmd((char_u *)":set isf+=(,)"); + do_cmdline_cmd(":set isf+=(,)"); alist_expand(NULL, 0); - do_cmdline_cmd((char_u *)":set isf&"); + do_cmdline_cmd(":set isf&"); } #endif return alist_name(&GARGLIST[0]); @@ -1438,7 +1437,7 @@ static void handle_tag(char_u *tagname) swap_exists_did_quit = FALSE; vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname); - do_cmdline_cmd(IObuff); + do_cmdline_cmd((char *)IObuff); TIME_MSG("jumping to tag"); /* If the user doesn't want to edit the file then we quit here. */ @@ -1715,7 +1714,7 @@ static void edit_buffers(mparm_T *parmp) */ static void exe_pre_commands(mparm_T *parmp) { - char_u **cmds = parmp->pre_commands; + char **cmds = parmp->pre_commands; int cnt = parmp->n_pre_commands; int i; @@ -1779,12 +1778,12 @@ static void source_startup_scripts(mparm_T *parmp) * nothing else. */ if (parmp->use_vimrc != NULL) { - if (STRCMP(parmp->use_vimrc, "NONE") == 0 - || STRCMP(parmp->use_vimrc, "NORC") == 0) { + if (strcmp(parmp->use_vimrc, "NONE") == 0 + || strcmp(parmp->use_vimrc, "NORC") == 0) { if (parmp->use_vimrc[2] == 'N') - p_lpl = FALSE; /* don't load plugins either */ + p_lpl = FALSE; // don't load plugins either } else { - if (do_source(parmp->use_vimrc, FALSE, DOSO_NONE) != OK) + if (do_source((char_u *)parmp->use_vimrc, FALSE, DOSO_NONE) != OK) EMSG2(_("E282: Cannot read from \"%s\""), parmp->use_vimrc); } } else if (!silent_mode) { @@ -1806,7 +1805,7 @@ static void source_startup_scripts(mparm_T *parmp) * - second user exrc file ($VIM/.exrc for Dos) * The first that exists is used, the rest is ignored. */ - if (process_env((char_u *)"VIMINIT", TRUE) != OK) { + if (process_env("VIMINIT", true) != OK) { if (do_source((char_u *)USR_VIMRC_FILE, TRUE, DOSO_VIMRC) == FAIL #ifdef USR_VIMRC_FILE2 && do_source((char_u *)USR_VIMRC_FILE2, TRUE, @@ -1816,7 +1815,7 @@ static void source_startup_scripts(mparm_T *parmp) && do_source((char_u *)USR_VIMRC_FILE3, TRUE, DOSO_VIMRC) == FAIL #endif - && process_env((char_u *)"EXINIT", FALSE) == FAIL + && process_env("EXINIT", FALSE) == FAIL && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL) { #ifdef USR_EXRC_FILE2 (void)do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE); @@ -1894,30 +1893,25 @@ static void main_start_gui(void) } -/* - * Get an environment variable, and execute it as Ex commands. - * Returns FAIL if the environment variable was not executed, OK otherwise. - */ -int -process_env ( - char_u *env, - int is_viminit /* when TRUE, called for VIMINIT */ -) +/// Get an environment variable, and execute it as Ex commands. +/// +/// @param env environment variable to execute +/// @param is_viminit when true, called for VIMINIT +/// +/// @return FAIL if the environment variable was not executed, +/// OK otherwise. +static int process_env(char *env, bool is_viminit) { - char_u *initstr; - char_u *save_sourcing_name; - linenr_T save_sourcing_lnum; - scid_T save_sid; - - initstr = (char_u *)os_getenv((char *)env); + char *initstr = (char *)os_getenv(env); if (initstr != NULL && *initstr != NUL) { - if (is_viminit) + if (is_viminit) { vimrc_found(NULL, NULL); - save_sourcing_name = sourcing_name; - save_sourcing_lnum = sourcing_lnum; - sourcing_name = env; + } + char_u *save_sourcing_name = sourcing_name; + linenr_T save_sourcing_lnum = sourcing_lnum; + sourcing_name = (char_u *)env; sourcing_lnum = 0; - save_sid = current_SID; + scid_T save_sid = current_SID; current_SID = SID_ENV; do_cmdline_cmd(initstr); sourcing_name = save_sourcing_name; diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 29263144a4..d654749acd 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -950,13 +950,13 @@ void ml_recover(void) } home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Using swap file \"%s\""), NameBuff); + smsg(_("Using swap file \"%s\""), NameBuff); if (buf_spname(curbuf) != NULL) STRLCPY(NameBuff, buf_spname(curbuf), MAXPATHL); else home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Original file \"%s\""), NameBuff); + smsg(_("Original file \"%s\""), NameBuff); msg_putchar('\n'); /* diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 8628661a98..85d56e3b90 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -498,9 +498,9 @@ void free_all_mem(void) /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ p_ea = FALSE; if (first_tabpage->tp_next != NULL) - do_cmdline_cmd((char_u *)"tabonly!"); + do_cmdline_cmd("tabonly!"); if (firstwin != lastwin) - do_cmdline_cmd((char_u *)"only!"); + do_cmdline_cmd("only!"); /* Free all spell info. */ spell_free_all(); @@ -509,18 +509,18 @@ void free_all_mem(void) ex_comclear(NULL); /* Clear menus. */ - do_cmdline_cmd((char_u *)"aunmenu *"); - do_cmdline_cmd((char_u *)"menutranslate clear"); + do_cmdline_cmd("aunmenu *"); + do_cmdline_cmd("menutranslate clear"); /* Clear mappings, abbreviations, breakpoints. */ - do_cmdline_cmd((char_u *)"lmapclear"); - do_cmdline_cmd((char_u *)"xmapclear"); - do_cmdline_cmd((char_u *)"mapclear"); - do_cmdline_cmd((char_u *)"mapclear!"); - do_cmdline_cmd((char_u *)"abclear"); - do_cmdline_cmd((char_u *)"breakdel *"); - do_cmdline_cmd((char_u *)"profdel *"); - do_cmdline_cmd((char_u *)"set keymap="); + do_cmdline_cmd("lmapclear"); + do_cmdline_cmd("xmapclear"); + do_cmdline_cmd("mapclear"); + do_cmdline_cmd("mapclear!"); + do_cmdline_cmd("abclear"); + do_cmdline_cmd("breakdel *"); + do_cmdline_cmd("profdel *"); + do_cmdline_cmd("set keymap="); free_titles(); free_findfile(); diff --git a/src/nvim/message.c b/src/nvim/message.c index 3667cf3be5..9bb92f8928 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -329,22 +329,22 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen) * shorter than IOSIZE!!! */ -int smsg(char_u *s, ...) +int smsg(char *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); + vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist, NULL); va_end(arglist); return msg(IObuff); } -int smsg_attr(int attr, char_u *s, ...) +int smsg_attr(int attr, char *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); + vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist, NULL); va_end(arglist); return msg_attr(IObuff, attr); } diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index db65ad724f..3ae3d6e30e 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -2296,7 +2296,8 @@ int ask_yesno(char_u *str, int direct) while (r != 'y' && r != 'n') { /* same highlighting as for wait_return */ - smsg_attr(hl_attr(HLF_R), (char_u *)"%s (y/n)?", str); + smsg_attr(hl_attr(HLF_R), + "%s (y/n)?", str); if (direct) r = get_keystroke(); else diff --git a/src/nvim/misc2.c b/src/nvim/misc2.c index 87a9556202..d9bc35470f 100644 --- a/src/nvim/misc2.c +++ b/src/nvim/misc2.c @@ -296,8 +296,8 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg) if (p_verbose > 3) { verbose_enter(); - smsg((char_u *)_("Calling shell to execute: \"%s\""), - cmd == NULL ? p_sh : cmd); + smsg(_("Calling shell to execute: \"%s\""), + cmd == NULL ? p_sh : cmd); ui_putc('\n'); verbose_leave(); } diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 3cf3636e23..7b42467184 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -4172,11 +4172,11 @@ static void nv_Zet(cmdarg_T *cap) if (!checkclearopq(cap->oap)) { switch (cap->nchar) { /* "ZZ": equivalent to ":x". */ - case 'Z': do_cmdline_cmd((char_u *)"x"); + case 'Z': do_cmdline_cmd("x"); break; /* "ZQ": equivalent to ":q!" (Elvis compatible). */ - case 'Q': do_cmdline_cmd((char_u *)"q!"); + case 'Q': do_cmdline_cmd("q!"); break; default: clearopbeep(cap->oap); @@ -4392,7 +4392,7 @@ static void nv_ident(cmdarg_T *cap) add_to_history(HIST_SEARCH, buf, true, NUL); (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0); } else - do_cmdline_cmd(buf); + do_cmdline_cmd((char *)buf); xfree(buf); } @@ -4704,9 +4704,9 @@ static void nv_down(cmdarg_T *cap) /* In a quickfix window a <CR> jumps to the error under the cursor. */ if (bt_quickfix(curbuf) && cap->cmdchar == CAR) if (curwin->w_llist_ref == NULL) - do_cmdline_cmd((char_u *)".cc"); /* quickfix window */ + do_cmdline_cmd(".cc"); /* quickfix window */ else - do_cmdline_cmd((char_u *)".ll"); /* location list window */ + do_cmdline_cmd(".ll"); /* location list window */ else { /* In the cmdline window a <CR> executes the command. */ if (cmdwin_type != 0 && cap->cmdchar == CAR) @@ -6018,7 +6018,7 @@ static void nv_suspend(cmdarg_T *cap) clearop(cap->oap); if (VIsual_active) end_visual_mode(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"st"); + do_cmdline_cmd("st"); } /* @@ -6045,7 +6045,7 @@ static void nv_g_cmd(cmdarg_T *cap) break; case '&': - do_cmdline_cmd((char_u *)"%s//~/&"); + do_cmdline_cmd("%s//~/&"); break; /* diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 268f2ac94f..2cbf74ac90 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -591,7 +591,7 @@ void op_reindent(oparg_T *oap, Indenter how) if (i > 1 && (i % 50 == 0 || i == oap->line_count - 1) && oap->line_count > p_report) - smsg((char_u *)_("%" PRId64 " lines to indent... "), (int64_t)i); + smsg(_("%" PRId64 " lines to indent... "), (int64_t)i); /* * Be vi-compatible: For lisp indenting the first line is not @@ -635,7 +635,7 @@ void op_reindent(oparg_T *oap, Indenter how) if (i == 1) MSG(_("1 line indented ")); else - smsg((char_u *)_("%" PRId64 " lines indented "), (int64_t)i); + smsg(_("%" PRId64 " lines indented "), (int64_t)i); } /* set '[ and '] marks */ curbuf->b_op_start = oap->start; @@ -1902,7 +1902,7 @@ void op_tilde(oparg_T *oap) if (oap->line_count == 1) MSG(_("1 line changed")); else - smsg((char_u *)_("%" PRId64 " lines changed"), (int64_t)oap->line_count); + smsg(_("%" PRId64 " lines changed"), (int64_t)oap->line_count); } } @@ -2497,10 +2497,10 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append) else MSG(_("1 line yanked")); } else if (oap->block_mode) - smsg((char_u *)_("block of %" PRId64 " lines yanked"), + smsg(_("block of %" PRId64 " lines yanked"), (int64_t)yanklines); else - smsg((char_u *)_("%" PRId64 " lines yanked"), (int64_t)yanklines); + smsg(_("%" PRId64 " lines yanked"), (int64_t)yanklines); } } diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c index 2a41001cde..52c10d0ca7 100644 --- a/src/nvim/os/fs.c +++ b/src/nvim/os/fs.c @@ -28,7 +28,7 @@ int os_chdir(const char *path) { if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)"chdir(%s)", path); + smsg("chdir(%s)", path); verbose_leave(); } return uv_chdir(path); diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 7e22da6e7a..4d53238381 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -1861,7 +1861,7 @@ void qf_age(exarg_T *eap) static void qf_msg(qf_info_T *qi) { - smsg((char_u *)_("error list %d of %d; %d errors"), + smsg(_("error list %d of %d; %d errors"), qi->qf_curlist + 1, qi->qf_listcount, qi->qf_lists[qi->qf_curlist].qf_count); qf_update_buffer(qi); @@ -2888,7 +2888,7 @@ void ex_vimgrep(exarg_T *eap) if (buf == NULL) { if (!got_int) - smsg((char_u *)_("Cannot open file \"%s\""), fname); + smsg(_("Cannot open file \"%s\""), fname); } else { /* Try for a match in all lines of the buffer. * For ":1vimgrep" look for first match only. */ diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index 133935b9c6..3e287e590b 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -6968,7 +6968,7 @@ regprog_T *vim_regcomp(char_u *expr_arg, int re_flags) regexp_engine = expr[4] - '0'; expr += 5; #ifdef REGEXP_DEBUG - smsg((char_u *)"New regexp mode selected (%d): %s", + smsg("New regexp mode selected (%d): %s", regexp_engine, regname[newengine]); #endif diff --git a/src/nvim/search.c b/src/nvim/search.c index 3542d1f711..464e112900 100644 --- a/src/nvim/search.c +++ b/src/nvim/search.c @@ -4200,7 +4200,7 @@ find_pattern_in_path ( msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); } else if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)_("Searching included file %s"), + smsg(_("Searching included file %s"), (char *)new_fname); verbose_leave(); } diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 6c6c4eb72a..d79ee4d200 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2327,9 +2327,8 @@ static void spell_load_lang(char_u *lang) } if (r == FAIL) { - smsg((char_u *) - _("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), - lang, spell_enc(), lang); + smsg(_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), + lang, spell_enc(), lang); } else if (sl.sl_slang != NULL) { // At least one file was loaded, now load ALL the additions. STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl"); @@ -2540,14 +2539,14 @@ spell_load_file ( EMSG2(_(e_notopen), fname); else if (p_verbose > 2) { verbose_enter(); - smsg(e_notopen, fname); + smsg((char *)e_notopen, fname); verbose_leave(); } goto endFAIL; } if (p_verbose > 2) { verbose_enter(); - smsg((char_u *)_("Reading spell file \"%s\""), fname); + smsg(_("Reading spell file \"%s\""), fname); verbose_leave(); } @@ -3824,9 +3823,8 @@ char_u *did_set_spelllang(win_T *wp) } else // This is probably an error. Give a warning and // accept the words anyway. - smsg((char_u *) - _("Warning: region %s not supported"), - region); + smsg(_("Warning: region %s not supported"), + region); } else region_mask = 1 << c; } @@ -4395,8 +4393,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (spin->si_conv.vc_type != CONV_NONE) { pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), - fname, lnum, rline); + smsg(_("Conversion failure for word in %s line %d: %s"), + fname, lnum, rline); continue; } line = pc; @@ -4436,8 +4434,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (!spin->si_ascii && convert_setup(&spin->si_conv, aff->af_enc, p_enc) == FAIL) - smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), - fname, aff->af_enc, p_enc); + smsg(_("Conversion in %s not supported: from %s to %s"), + fname, aff->af_enc, p_enc); spin->si_conv.vc_fail = true; } else if (is_aff_rule(items, itemcnt, "FLAG", 2) && aff->af_flagtype == AFT_CHAR) { @@ -4448,8 +4446,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) else if (STRCMP(items[1], "caplong") == 0) aff->af_flagtype = AFT_CAPLONG; else - smsg((char_u *)_("Invalid value for FLAG in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Invalid value for FLAG in %s line %d: %s"), + fname, lnum, items[1]); if (aff->af_rare != 0 || aff->af_keepcase != 0 || aff->af_bad != 0 @@ -4461,8 +4459,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) || compflags != NULL || aff->af_suff.ht_used > 0 || aff->af_pref.ht_used > 0) - smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("FLAG after using flags in %s line %d: %s"), + fname, lnum, items[1]); } else if (spell_info_item(items[0]) && itemcnt > 1) { p = (char_u *)getroom(spin, (spin->si_info == NULL ? 0 : STRLEN(spin->si_info)) @@ -4528,17 +4526,15 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], fname, lnum); if (aff->af_pref.ht_used > 0) - smsg((char_u *)_( - "Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), - fname, lnum); + smsg(_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), + fname, lnum); } else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) && aff->af_comppermit == 0) { aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], fname, lnum); if (aff->af_pref.ht_used > 0) - smsg((char_u *)_( - "Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), - fname, lnum); + smsg(_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), + fname, lnum); } else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) && compflags == NULL) { // Turn flag "c" into COMPOUNDRULE compatible string "c+", @@ -4551,8 +4547,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) // We don't use the count, but do check that it's a number and // not COMPOUNDRULE mistyped. if (atoi((char *)items[1]) == 0) - smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Wrong COMPOUNDRULES value in %s line %d: %s"), + fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) { // Don't use the first rule if it is a number. if (compflags != NULL || *skipdigits(items[1]) != NUL) { @@ -4573,20 +4569,20 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) && compmax == 0) { compmax = atoi((char *)items[1]); if (compmax == 0) - smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), + fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) && compminlen == 0) { compminlen = atoi((char *)items[1]); if (compminlen == 0) - smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Wrong COMPOUNDMIN value in %s line %d: %s"), + fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) && compsylmax == 0) { compsylmax = atoi((char *)items[1]); if (compsylmax == 0) - smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), + fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) { compoptions |= COMP_CHECKDUP; } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) { @@ -4597,8 +4593,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) compoptions |= COMP_CHECKTRIPLE; } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) { if (atoi((char *)items[1]) == 0) - smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), + fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) { garray_T *gap = &spin->si_comppat; int i; @@ -4650,12 +4646,11 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (!HASHITEM_EMPTY(hi)) { cur_aff = HI2AH(hi); if (cur_aff->ah_combine != (*items[2] == 'Y')) - smsg((char_u *)_( - "Different combining flag in continued affix block in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Different combining flag in continued affix block in %s line %d: %s"), + fname, lnum, items[1]); if (!cur_aff->ah_follows) - smsg((char_u *)_("Duplicate affix in %s line %d: %s"), - fname, lnum, items[1]); + smsg(_("Duplicate affix in %s line %d: %s"), + fname, lnum, items[1]); } else { // New affix letter. cur_aff = (affheader_T *)getroom(spin, @@ -4674,8 +4669,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) || cur_aff->ah_flag == aff->af_nosuggest || cur_aff->ah_flag == aff->af_needcomp || cur_aff->ah_flag == aff->af_comproot) - smsg((char_u *)_( - "Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"), + smsg(_("Affix also used for " + "BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST" + "in %s line %d: %s"), fname, lnum, items[1]); STRCPY(cur_aff->ah_key, items[1]); hash_add(tp, cur_aff->ah_key); @@ -4697,10 +4693,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (itemcnt > lasti && !aff->af_ignoreextra && *items[lasti] != '#') - smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); + smsg(_(e_afftrailing), fname, lnum, items[lasti]); if (STRCMP(items[2], "Y") != 0 && STRCMP(items[2], "N") != 0) - smsg((char_u *)_("Expected Y or N in %s line %d: %s"), + smsg(_("Expected Y or N in %s line %d: %s"), fname, lnum, items[2]); if (*items[0] == 'P' && aff->af_pfxpostpone) { @@ -4735,7 +4731,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (itemcnt > lasti && *items[lasti] != '#' && (STRCMP(items[lasti], "-") != 0 || itemcnt != lasti + 1)) - smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); + smsg(_(e_afftrailing), fname, lnum, items[lasti]); // New item for an affix letter. --aff_todo; @@ -4775,8 +4771,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) aff_entry->ae_prog = vim_regcomp(buf, RE_MAGIC + RE_STRING + RE_STRICT); if (aff_entry->ae_prog == NULL) - smsg((char_u *)_("Broken condition in %s line %d: %s"), - fname, lnum, items[4]); + smsg(_("Broken condition in %s line %d: %s"), + fname, lnum, items[4]); } // For postponed prefixes we need an entry in si_prefcond @@ -4893,8 +4889,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) || is_aff_rule(items, itemcnt, "REPSAL", 2)) { /* Ignore REP/REPSAL count */; if (!isdigit(*items[1])) - smsg((char_u *)_("Expected REP(SAL) count in %s line %d"), - fname, lnum); + smsg(_("Expected REP(SAL) count in %s line %d"), + fname, lnum); } else if ((STRCMP(items[0], "REP") == 0 || STRCMP(items[0], "REPSAL") == 0) && itemcnt >= 3) { @@ -4902,7 +4898,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) // Myspell ignores extra arguments, we require it starts with // # to detect mistakes. if (itemcnt > 3 && items[3][0] != '#') - smsg((char_u *)_(e_afftrailing), fname, lnum, items[3]); + smsg(_(e_afftrailing), fname, lnum, items[3]); if (items[0][3] == 'S' ? do_repsal : do_rep) { // Replace underscore with space (can't include a space // directly). @@ -4922,8 +4918,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) // First line contains the count. found_map = true; if (!isdigit(*items[1])) - smsg((char_u *)_("Expected MAP count in %s line %d"), - fname, lnum); + smsg(_("Expected MAP count in %s line %d"), + fname, lnum); } else if (do_mapline) { int c; @@ -4934,8 +4930,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) && vim_strchr(spin->si_map.ga_data, c) != NULL) || vim_strchr(p, c) != NULL) - smsg((char_u *)_("Duplicate character in MAP in %s line %d"), - fname, lnum); + smsg(_("Duplicate character in MAP in %s line %d"), + fname, lnum); } // We simply concatenate all the MAP strings, separated by @@ -4978,8 +4974,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) } } } else - smsg((char_u *)_("Unrecognized or duplicate item in %s line %d: %s"), - fname, lnum, items[0]); + smsg(_("Unrecognized or duplicate item in %s line %d: %s"), + fname, lnum, items[0]); } } @@ -4999,7 +4995,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) && !enc_utf8 ) { if (fol == NULL || low == NULL || upp == NULL) - smsg((char_u *)_("Missing FOL/LOW/UPP line in %s"), fname); + smsg(_("Missing FOL/LOW/UPP line in %s"), fname); else (void)set_spell_chartab(fol, low, upp); } @@ -5022,7 +5018,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (compsylmax != 0) { if (syllable == NULL) - smsg((char_u *)_("COMPOUNDSYLMAX used without SYLLABLE")); + smsg(_("COMPOUNDSYLMAX used without SYLLABLE")); aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX"); spin->si_compsylmax = compsylmax; } @@ -5052,10 +5048,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname) if (sofofrom != NULL || sofoto != NULL) { if (sofofrom == NULL || sofoto == NULL) - smsg((char_u *)_("Missing SOFO%s line in %s"), - sofofrom == NULL ? "FROM" : "TO", fname); + smsg(_("Missing SOFO%s line in %s"), + sofofrom == NULL ? "FROM" : "TO", fname); else if (!GA_EMPTY(&spin->si_sal)) - smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname); + smsg(_("Both SAL and SOFO lines in %s"), fname); else { aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM"); aff_check_string(spin->si_sofoto, sofoto, "SOFOTO"); @@ -5133,14 +5129,14 @@ static unsigned affitem2flag(int flagtype, char_u *item, char_u *fname, int lnum res = get_affitem(flagtype, &p); if (res == 0) { if (flagtype == AFT_NUM) - smsg((char_u *)_("Flag is not a number in %s line %d: %s"), - fname, lnum, item); + smsg(_("Flag is not a number in %s line %d: %s"), + fname, lnum, item); else - smsg((char_u *)_("Illegal flag in %s line %d: %s"), - fname, lnum, item); + smsg(_("Illegal flag in %s line %d: %s"), + fname, lnum, item); } if (*p != NUL) { - smsg((char_u *)_(e_affname), fname, lnum, item); + smsg(_(e_affname), fname, lnum, item); return 0; } @@ -5294,16 +5290,16 @@ static bool flag_in_afflist(int flagtype, char_u *afflist, unsigned flag) static void aff_check_number(int spinval, int affval, char *name) { if (spinval != 0 && spinval != affval) - smsg((char_u *)_( - "%s value differs from what is used in another .aff file"), name); + smsg(_("%s value differs from what is used in another .aff file"), + name); } // Give a warning when "spinval" and "affval" strings are set and not the same. static void aff_check_string(char_u *spinval, char_u *affval, char *name) { if (spinval != NULL && STRCMP(spinval, affval) != 0) - smsg((char_u *)_( - "%s value differs from what is used in another .aff file"), name); + smsg(_("%s value differs from what is used in another .aff file"), + name); } // Returns true if strings "s1" and "s2" are equal. Also consider both being @@ -5434,8 +5430,8 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) if (spin->si_conv.vc_type != CONV_NONE) { pc = string_convert(&spin->si_conv, line, NULL); if (pc == NULL) { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), - fname, lnum, line); + smsg(_("Conversion failure for word in %s line %d: %s"), + fname, lnum, line); continue; } w = pc; @@ -5490,11 +5486,11 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) hi = hash_lookup(&ht, dw, hash); if (!HASHITEM_EMPTY(hi)) { if (p_verbose > 0) - smsg((char_u *)_("Duplicate word in %s line %d: %s"), - fname, lnum, dw); + smsg(_("Duplicate word in %s line %d: %s"), + fname, lnum, dw); else if (duplicate == 0) - smsg((char_u *)_("First duplicate word in %s line %d: %s"), - fname, lnum, dw); + smsg(_("First duplicate word in %s line %d: %s"), + fname, lnum, dw); ++duplicate; } else hash_add_item(&ht, hi, dw, hash); @@ -5545,10 +5541,10 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile) } if (duplicate > 0) - smsg((char_u *)_("%d duplicate word(s) in %s"), duplicate, fname); + smsg(_("%d duplicate word(s) in %s"), duplicate, fname); if (spin->si_ascii && non_ascii > 0) - smsg((char_u *)_("Ignored %d word(s) with non-ASCII characters in %s"), - non_ascii, fname); + smsg(_("Ignored %d word(s) with non-ASCII characters in %s"), + non_ascii, fname); hash_clear(&ht); fclose(fd); @@ -5938,8 +5934,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname) if (spin->si_conv.vc_type != CONV_NONE) { pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), - fname, lnum, rline); + smsg(_("Conversion failure for word in %s line %d: %s"), + fname, lnum, rline); continue; } line = pc; @@ -5952,13 +5948,11 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname) ++line; if (STRNCMP(line, "encoding=", 9) == 0) { if (spin->si_conv.vc_type != CONV_NONE) - smsg((char_u *)_( - "Duplicate /encoding= line ignored in %s line %d: %s"), - fname, lnum, line - 1); + smsg(_("Duplicate /encoding= line ignored in %s line %d: %s"), + fname, lnum, line - 1); else if (did_word) - smsg((char_u *)_( - "/encoding= line after word ignored in %s line %d: %s"), - fname, lnum, line - 1); + smsg(_("/encoding= line after word ignored in %s line %d: %s"), + fname, lnum, line - 1); else { char_u *enc; @@ -5968,8 +5962,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname) if (!spin->si_ascii && convert_setup(&spin->si_conv, enc, p_enc) == FAIL) - smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), - fname, line, p_enc); + smsg(_("Conversion in %s not supported: from %s to %s"), + fname, line, p_enc); xfree(enc); spin->si_conv.vc_fail = true; } @@ -5978,13 +5972,13 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname) if (STRNCMP(line, "regions=", 8) == 0) { if (spin->si_region_count > 1) - smsg((char_u *)_("Duplicate /regions= line ignored in %s line %d: %s"), - fname, lnum, line); + smsg(_("Duplicate /regions= line ignored in %s line %d: %s"), + fname, lnum, line); else { line += 8; if (STRLEN(line) > 16) - smsg((char_u *)_("Too many regions in %s line %d: %s"), - fname, lnum, line); + smsg(_("Too many regions in %s line %d: %s"), + fname, lnum, line); else { spin->si_region_count = (int)STRLEN(line) / 2; STRCPY(spin->si_region_name, line); @@ -5996,8 +5990,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname) continue; } - smsg((char_u *)_("/ line ignored in %s line %d: %s"), - fname, lnum, line - 1); + smsg(_("/ line ignored in %s line %d: %s"), + fname, lnum, line - 1); continue; } @@ -6022,14 +6016,14 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname) l = *p - '0'; if (l > spin->si_region_count) { - smsg((char_u *)_("Invalid region nr in %s line %d: %s"), - fname, lnum, p); + smsg(_("Invalid region nr in %s line %d: %s"), + fname, lnum, p); break; } regionmask |= 1 << (l - 1); } else { - smsg((char_u *)_("Unrecognized flags in %s line %d: %s"), - fname, lnum, p); + smsg(_("Unrecognized flags in %s line %d: %s"), + fname, lnum, p); break; } ++p; @@ -7146,8 +7140,8 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname) if (sug_maketable(spin) == FAIL) goto theend; - smsg((char_u *)_("Number of words after soundfolding: %" PRId64), - (int64_t)spin->si_spellbuf->b_ml.ml_line_count); + smsg(_("Number of words after soundfolding: %" PRId64), + (int64_t)spin->si_spellbuf->b_ml.ml_line_count); // Compress the soundfold trie. spell_message(spin, (char_u *)_(msg_compressing)); @@ -7254,7 +7248,7 @@ static int sug_filltree(spellinfo_T *spin, slang_T *slang) } } - smsg((char_u *)_("Total number of words: %d"), words_done); + smsg(_("Total number of words: %d"), words_done); return OK; } @@ -7847,8 +7841,8 @@ spell_add_word ( fputc('#', fd); if (undo) { home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Word '%.*s' removed from %s"), - len, word, NameBuff); + smsg(_("Word '%.*s' removed from %s"), + len, word, NameBuff); } } fseek(fd, fpos_next, SEEK_SET); @@ -7890,7 +7884,7 @@ spell_add_word ( fclose(fd); home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Word '%.*s' added to %s"), len, word, NameBuff); + smsg(_("Word '%.*s' added to %s"), len, word, NameBuff); } } @@ -8457,8 +8451,8 @@ void spell_suggest(int count) MSG(_("Sorry, no suggestions")); else if (count > 0) { if (count > sug.su_ga.ga_len) - smsg((char_u *)_("Sorry, only %" PRId64 " suggestions"), - (int64_t)sug.su_ga.ga_len); + smsg(_("Sorry, only %" PRId64 " suggestions"), + (int64_t)sug.su_ga.ga_len); } else { xfree(repl_from); repl_from = NULL; @@ -11190,7 +11184,6 @@ badword: } } } - // smsg("word %s (%d): %s (%d)", sftword, sftnr, theword, orgnr); } } @@ -12901,7 +12894,7 @@ void ex_spelldump(exarg_T *eap) get_option_value((char_u*)"spl", &dummy, &spl, OPT_LOCAL); // Create a new empty buffer in a new window. - do_cmdline_cmd((char_u *)"new"); + do_cmdline_cmd("new"); // enable spelling locally in the new window set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL); diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 0bee42c4a9..d0491ab42b 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -3268,7 +3268,7 @@ static void syn_cmd_reset(exarg_T *eap, int syncing) eap->nextcmd = check_nextcmd(eap->arg); if (!eap->skip) { set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset"); - do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim"); + do_cmdline_cmd("runtime! syntax/syncolor.vim"); do_unlet((char_u *)"g:syntax_cmd", TRUE); } } @@ -3291,12 +3291,12 @@ static void syn_cmd_off(exarg_T *eap, int syncing) static void syn_cmd_onoff(exarg_T *eap, char *name) { - char_u buf[100]; + char buf[100]; eap->nextcmd = check_nextcmd(eap->arg); if (!eap->skip) { - STRCPY(buf, "so "); - vim_snprintf((char *)buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name); + strcpy(buf, "so "); + vim_snprintf(buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name); do_cmdline_cmd(buf); } } diff --git a/src/nvim/tag.c b/src/nvim/tag.c index a087986685..75055cc21a 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -856,7 +856,7 @@ do_tag ( * file didn't exist. Otherwise an EMSG() is given below. */ if (nofile_fname != NULL && error_cur_match != cur_match) - smsg((char_u *)_("File \"%s\" does not exist"), nofile_fname); + smsg(_("File \"%s\" does not exist"), nofile_fname); ic = (matches[cur_match][0] & MT_IC_OFF); @@ -1289,7 +1289,7 @@ find_tags ( if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)_("Searching tags file %s"), tag_fname); + smsg(_("Searching tags file %s"), tag_fname); verbose_leave(); } } @@ -2511,7 +2511,7 @@ jumpto_tag ( check_cursor(); } else { curwin->w_cursor.lnum = 1; /* start command in line 1 */ - do_cmdline_cmd(pbuf); + do_cmdline_cmd((char *)pbuf); retval = OK; } @@ -2742,7 +2742,7 @@ add_tag_field ( if (dict_find(dict, (char_u *)field_name, -1) != NULL) { if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Duplicate field name: %s"), field_name); + smsg(_("Duplicate field name: %s"), field_name); verbose_leave(); } return FAIL; diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index 8ee47b2642..9195004a54 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -412,7 +412,7 @@ end: ui_busy_stop(); if (close) { term->opts.close_cb(term->opts.data); - do_cmdline_cmd((uint8_t *)"bwipeout!"); + do_cmdline_cmd("bwipeout!"); } } diff --git a/src/nvim/undo.c b/src/nvim/undo.c index ef1ac60599..329af8acdd 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -159,12 +159,12 @@ static void u_check_tree(u_header_T *uhp, /* Check pointers back are correct. */ if (uhp->uh_next.ptr != exp_uh_next) { EMSG("uh_next wrong"); - smsg((char_u *)"expected: 0x%x, actual: 0x%x", + smsg("expected: 0x%x, actual: 0x%x", exp_uh_next, uhp->uh_next.ptr); } if (uhp->uh_alt_prev.ptr != exp_uh_alt_prev) { EMSG("uh_alt_prev wrong"); - smsg((char_u *)"expected: 0x%x, actual: 0x%x", + smsg("expected: 0x%x, actual: 0x%x", exp_uh_alt_prev, uhp->uh_alt_prev.ptr); } @@ -198,7 +198,7 @@ static void u_check(int newhead_may_be_NULL) { EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead); if (header_count != curbuf->b_u_numhead) { EMSG("b_u_numhead invalid"); - smsg((char_u *)"expected: %" PRId64 ", actual: %" PRId64, + smsg("expected: %" PRId64 ", actual: %" PRId64, (int64_t)header_count, (int64_t)curbuf->b_u_numhead); } } @@ -1013,8 +1013,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) if (file_name == NULL) { if (p_verbose > 0) { verbose_enter(); - smsg((char_u *) - _("Cannot write undo file in any directory in 'undodir'")); + smsg(_("Cannot write undo file in any directory in 'undodir'")); verbose_leave(); } return; @@ -1048,9 +1047,8 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) if (name != NULL || p_verbose > 0) { if (name == NULL) verbose_enter(); - smsg((char_u *) - _("Will not overwrite with undo file, cannot read: %s"), - file_name); + smsg(_("Will not overwrite with undo file, cannot read: %s"), + file_name); if (name == NULL) verbose_leave(); } @@ -1064,9 +1062,8 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) if (name != NULL || p_verbose > 0) { if (name == NULL) verbose_enter(); - smsg((char_u *) - _("Will not overwrite, this is not an undo file: %s"), - file_name); + smsg(_("Will not overwrite, this is not an undo file: %s"), + file_name); if (name == NULL) verbose_leave(); } @@ -1094,7 +1091,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash) (void)os_setperm(file_name, perm); if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Writing undo file: %s"), file_name); + smsg(_("Writing undo file: %s"), file_name); verbose_leave(); } @@ -1236,8 +1233,8 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name) && file_info_undo.stat.st_uid != getuid()) { if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Not reading undo file, owner differs: %s"), - file_name); + smsg(_("Not reading undo file, owner differs: %s"), + file_name); verbose_leave(); } return; @@ -1249,7 +1246,7 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name) if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Reading undo file: %s"), file_name); + smsg(_("Reading undo file: %s"), file_name); verbose_leave(); } @@ -1483,7 +1480,7 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name) #endif if (name != NULL) { - smsg((char_u *)_("Finished reading undo file %s"), file_name); + smsg(_("Finished reading undo file %s"), file_name); } goto theend; @@ -2289,7 +2286,7 @@ u_undo_end ( } } - smsg((char_u *)_("%" PRId64 " %s; %s #%" PRId64 " %s"), + smsg(_("%" PRId64 " %s; %s #%" PRId64 " %s"), u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount, _(msgstr), did_undo ? _("before") : _("after"), diff --git a/src/nvim/window.c b/src/nvim/window.c index c97dc22741..ef6b53fe2e 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -87,7 +87,7 @@ do_window ( linenr_T lnum = -1; int type = FIND_DEFINE; size_t len; - char_u cbuf[40]; + char cbuf[40]; if (Prenum == 0) Prenum1 = 1; @@ -124,7 +124,7 @@ do_window ( case Ctrl_HAT: case '^': CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ - cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum); + cmd_with_count("split #", (char_u *)cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -135,12 +135,12 @@ do_window ( newwindow: if (Prenum) /* window height */ - vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum); + vim_snprintf(cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum); else cbuf[0] = NUL; if (nchar == 'v' || nchar == Ctrl_V) - STRCAT(cbuf, "v"); - STRCAT(cbuf, "new"); + strcat(cbuf, "v"); + strcat(cbuf, "new"); do_cmdline_cmd(cbuf); break; @@ -148,7 +148,7 @@ newwindow: case Ctrl_Q: case 'q': reset_VIsual_and_resel(); /* stop Visual mode */ - cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum); + cmd_with_count("quit", (char_u *)cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -156,7 +156,7 @@ newwindow: case Ctrl_C: case 'c': reset_VIsual_and_resel(); /* stop Visual mode */ - cmd_with_count("close", cbuf, sizeof(cbuf), Prenum); + cmd_with_count("close", (char_u *)cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -164,7 +164,7 @@ newwindow: case Ctrl_Z: case 'z': CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ - do_cmdline_cmd((char_u *)"pclose"); + do_cmdline_cmd("pclose"); break; /* cursor to preview window */ @@ -182,7 +182,7 @@ newwindow: case Ctrl_O: case 'o': CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ - cmd_with_count("only", cbuf, sizeof(cbuf), Prenum); + cmd_with_count("only", (char_u *)cbuf, sizeof(cbuf), Prenum); do_cmdline_cmd(cbuf); break; @@ -430,7 +430,7 @@ wingotofile: * cursor in a new window. */ if (bt_quickfix(curbuf)) { - sprintf((char *)cbuf, "split +%" PRId64 "%s", + sprintf(cbuf, "split +%" PRId64 "%s", (int64_t)curwin->w_cursor.lnum, (curwin->w_llist_ref == NULL) ? "cc" : "ll"); do_cmdline_cmd(cbuf); |