aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-10-18 09:08:46 -0400
committerJames McCoy <jamessan@jamessan.com>2021-11-01 06:41:28 -0400
commitefa924f66b183d9cf2404ce91c4f009c27e0515a (patch)
treeadc8c74cba88e76c2ae0548cd6e9b01804da9933 /src/nvim/os
parent684640f5518a483cf2bc48efc8f68449379cef69 (diff)
downloadrneovim-efa924f66b183d9cf2404ce91c4f009c27e0515a.tar.gz
rneovim-efa924f66b183d9cf2404ce91c4f009c27e0515a.tar.bz2
rneovim-efa924f66b183d9cf2404ce91c4f009c27e0515a.zip
vim-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 vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/dl.c4
-rw-r--r--src/nvim/os/env.c12
-rw-r--r--src/nvim/os/fileio.c2
-rw-r--r--src/nvim/os/fs.c6
-rw-r--r--src/nvim/os/shell.c6
-rw-r--r--src/nvim/os/users.c2
6 files changed, 16 insertions, 16 deletions
diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c
index b2e3994d10..7d095d31e3 100644
--- a/src/nvim/os/dl.c
+++ b/src/nvim/os/dl.c
@@ -49,7 +49,7 @@ bool os_libcall(const char *libname, const char *funcname, const char *argv, int
// open the dynamic loadable library
if (uv_dlopen(libname, &lib)) {
- EMSG2(_("dlerror = \"%s\""), uv_dlerror(&lib));
+ semsg(_("dlerror = \"%s\""), uv_dlerror(&lib));
uv_dlclose(&lib);
return false;
}
@@ -57,7 +57,7 @@ bool os_libcall(const char *libname, const char *funcname, const char *argv, int
// find and load the requested function in the library
gen_fn fn;
if (uv_dlsym(&lib, funcname, (void **)&fn)) {
- EMSG2(_("dlerror = \"%s\""), uv_dlerror(&lib));
+ semsg(_("dlerror = \"%s\""), uv_dlerror(&lib));
uv_dlclose(&lib);
return false;
}
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 0f363ecfc3..727b10f7a7 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -250,7 +250,7 @@ void os_copy_fullenv(char **env, size_t env_size)
char *utf8_str;
int conversion_result = utf16_to_utf8(p, -1, &utf8_str);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
break;
}
p += l + 1;
@@ -297,7 +297,7 @@ char *os_getenvname_at_index(size_t index)
char *utf8_str;
int conversion_result = utf16_to_utf8(p, -1, &utf8_str);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
break;
}
@@ -375,7 +375,7 @@ void os_get_hostname(char *hostname, size_t size)
if (GetComputerNameW(host_utf16, &host_wsize) == 0) {
*hostname = '\0';
DWORD err = GetLastError();
- EMSG2("GetComputerNameW failed: %d", err);
+ semsg("GetComputerNameW failed: %d", err);
return;
}
host_utf16[host_wsize] = '\0';
@@ -383,13 +383,13 @@ void os_get_hostname(char *hostname, size_t size)
char *host_utf8;
int conversion_result = utf16_to_utf8(host_utf16, -1, &host_utf8);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
return;
}
xstrlcpy(hostname, host_utf8, size);
xfree(host_utf8);
#else
- EMSG("os_get_hostname failed: missing uname()");
+ emsg("os_get_hostname failed: missing uname()");
*hostname = '\0';
#endif
}
@@ -481,7 +481,7 @@ void init_homedir(void)
var = (char *)IObuff;
}
if (os_chdir(os_buf) != 0) {
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
}
}
diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c
index 1ae6ca4244..b1710737d0 100644
--- a/src/nvim/os/fileio.c
+++ b/src/nvim/os/fileio.c
@@ -426,6 +426,6 @@ int msgpack_file_write(void *data, const char *buf, size_t len)
/// @return -1 (error return for msgpack_packer callbacks).
int msgpack_file_write_error(const int error)
{
- emsgf(_("E5420: Failed to write to file: %s"), os_strerror(error));
+ semsg(_("E5420: Failed to write to file: %s"), os_strerror(error));
return -1;
}
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 9675cfbb0f..3ff13c2b3f 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -1212,7 +1212,7 @@ char *os_resolve_shortcut(const char *fname)
wchar_t *p;
const int r = utf8_to_utf16(fname, -1, &p);
if (r != 0) {
- EMSG2("utf8_to_utf16 failed: %d", r);
+ semsg("utf8_to_utf16 failed: %d", r);
} else if (p != NULL) {
// Get a pointer to the IPersistFile interface.
hr = pslw->lpVtbl->QueryInterface(pslw, &IID_IPersistFile, (void **)&ppf);
@@ -1239,7 +1239,7 @@ char *os_resolve_shortcut(const char *fname)
if (hr == S_OK && wsz[0] != NUL) {
const int r2 = utf16_to_utf8(wsz, -1, &rfname);
if (r2 != 0) {
- EMSG2("utf16_to_utf8 failed: %d", r2);
+ semsg("utf16_to_utf8 failed: %d", r2);
}
}
@@ -1274,7 +1274,7 @@ bool os_is_reparse_point_include(const char *path)
const int r = utf8_to_utf16(path, -1, &utf16_path);
if (r != 0) {
- EMSG2("utf8_to_utf16 failed: %d", r);
+ semsg("utf8_to_utf16 failed: %d", r);
return false;
}
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 2bff65b241..1399fc758c 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -159,7 +159,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
// get a name for the temp file
if ((tempname = vim_tempname()) == NULL) {
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
return FAIL;
}
@@ -389,7 +389,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
os_remove((char *)tempname);
if (readlen != len) {
// unexpected read error
- EMSG2(_(e_notread), tempname);
+ semsg(_(e_notread), tempname);
xfree(tempname);
xfree(buffer);
return FAIL;
@@ -1180,7 +1180,7 @@ static void shell_write_cb(Stream *stream, void *data, int status)
if (status) {
// Can happen if system() tries to send input to a shell command that was
// backgrounded (:call system("cat - &", "foo")). #3529 #5241
- msg_schedule_emsgf(_("E5677: Error writing input to shell-command: %s"),
+ msg_schedule_semsg(_("E5677: Error writing input to shell-command: %s"),
uv_err_name(status));
}
stream_close(stream, NULL, NULL);
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index fd7ead68da..9952e2b387 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -64,7 +64,7 @@ int os_get_usernames(garray_T *users)
char *user;
int conversion_result = utf16_to_utf8(uinfo[i].usri0_name, -1, &user);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
break;
}
add_user(users, user, false);