Mercurial > vim
diff src/os_unix.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 7fff2d18e191 |
children | 3ef31ce9d9f9 |
line wrap: on
line diff
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -327,7 +327,7 @@ mch_chdir(char *path) if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)"chdir(%s)", path); + smsg("chdir(%s)", path); verbose_leave(); } # ifdef VMS @@ -1004,7 +1004,7 @@ static volatile sig_atomic_t lc_active I * if (SETJMP(lc_jump_env) != 0) * { * mch_didjmp(); - * EMSG("crash!"); + * emsg("crash!"); * } * else * { @@ -1632,7 +1632,7 @@ mch_input_isatty(void) static void xopen_message(long elapsed_msec) { - smsg((char_u *)_("Opening the X display took %ld msec"), elapsed_msec); + smsg(_("Opening the X display took %ld msec"), elapsed_msec); } # endif #endif @@ -2670,7 +2670,7 @@ mch_FullName( #endif l = mch_chdir((char *)olddir); if (l != 0) - EMSG(_(e_prev_dir)); + emsg(_(e_prev_dir)); } l = STRLEN(buf); @@ -3974,7 +3974,7 @@ check_mouse_termcode(void) int mch_screenmode(char_u *arg UNUSED) { - EMSG(_(e_screenmode)); + emsg(_(e_screenmode)); return FAIL; } @@ -5454,7 +5454,7 @@ mch_job_start(char **argv, job_T *job, j fd_in[0] = mch_open((char *)fname, O_RDONLY, 0); if (fd_in[0] < 0) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -5472,7 +5472,7 @@ mch_job_start(char **argv, job_T *job, j fd_out[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd_out[1] < 0) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -5486,7 +5486,7 @@ mch_job_start(char **argv, job_T *job, j fd_err[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd_err[1] < 0) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -6509,7 +6509,7 @@ mch_expand_wildcards( */ if ((tempname = vim_tempname('o', FALSE)) == NULL) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); return FAIL; } @@ -6763,7 +6763,7 @@ mch_expand_wildcards( if (i != (int)len) { /* unexpected read error */ - EMSG2(_(e_notread), tempname); + semsg(_(e_notread), tempname); vim_free(tempname); vim_free(buffer); return FAIL; @@ -7347,7 +7347,7 @@ mch_libcall( /* "dlerr" must be used before dlclose() */ dlerr = (char *)dlerror(); if (dlerr != NULL) - EMSG2(_("dlerror = \"%s\""), dlerr); + semsg(_("dlerror = \"%s\""), dlerr); } # else hinstLib = shl_load((const char*)libname, BIND_IMMEDIATE|BIND_VERBOSE, 0L); @@ -7442,7 +7442,7 @@ mch_libcall( for (i = 0; signal_info[i].sig != -1; i++) if (lc_signal == signal_info[i].sig) break; - EMSG2("E368: got SIG%s in libcall()", signal_info[i].name); + semsg("E368: got SIG%s in libcall()", signal_info[i].name); } # endif # endif @@ -7450,7 +7450,7 @@ mch_libcall( # if defined(USE_DLOPEN) /* "dlerr" must be used before dlclose() */ if (dlerr != NULL) - EMSG2(_("dlerror = \"%s\""), dlerr); + semsg(_("dlerror = \"%s\""), dlerr); /* Free the DLL module. */ (void)dlclose(hinstLib); @@ -7461,7 +7461,7 @@ mch_libcall( if (!success) { - EMSG2(_(e_libcall), funcname); + semsg(_(e_libcall), funcname); return FAIL; }