aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/env.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os/env.c')
-rw-r--r--src/nvim/os/env.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 33b67a8116..f5dbf0694e 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -178,7 +178,7 @@ char *os_getenvname_at_index(size_t index)
for (wchar_t *it = env; *it != L'\0' || *(it + 1) != L'\0'; it++) {
if (index == current_index) {
char *utf8_str;
- int conversion_result = utf16_to_utf8(it, &utf8_str);
+ int conversion_result = utf16_to_utf8(it, -1, &utf8_str);
if (conversion_result != 0) {
EMSG2("utf16_to_utf8 failed: %d", conversion_result);
break;
@@ -258,7 +258,7 @@ void os_get_hostname(char *hostname, size_t size)
host_utf16[host_wsize] = '\0';
char *host_utf8;
- int conversion_result = utf16_to_utf8(host_utf16, &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);
return;
@@ -412,6 +412,7 @@ void expand_env_esc(char_u *restrict srcp,
bool esc,
bool one,
char_u *prefix)
+ FUNC_ATTR_NONNULL_ARG(1, 2)
{
char_u *tail;
char_u *var;
@@ -845,10 +846,10 @@ char *vim_getenv(const char *name)
// next time, and others can also use it (e.g. Perl).
if (vim_path != NULL) {
if (vimruntime) {
- vim_setenv("VIMRUNTIME", vim_path);
+ os_setenv("VIMRUNTIME", vim_path, 1);
didset_vimruntime = true;
} else {
- vim_setenv("VIM", vim_path);
+ os_setenv("VIM", vim_path, 1);
didset_vim = true;
}
}
@@ -995,22 +996,6 @@ char_u * home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
return dst;
}
-/// Vim setenv() wrapper with special handling for $VIMRUNTIME to keep the
-/// localization machinery sane.
-void vim_setenv(const char *name, const char *val)
-{
- os_setenv(name, val, 1);
-#ifndef LOCALE_INSTALL_DIR
- // When setting $VIMRUNTIME adjust the directory to find message
- // translations to $VIMRUNTIME/lang.
- if (*val != NUL && STRICMP(name, "VIMRUNTIME") == 0) {
- char *buf = (char *)concat_str((char_u *)val, (char_u *)"/lang");
- bindtextdomain(PROJECT_NAME, buf);
- xfree(buf);
- }
-#endif
-}
-
/// Function given to ExpandGeneric() to obtain an environment variable name.
char_u *get_env_name(expand_T *xp, int idx)