mirror of
https://github.com/neovim/neovim.git
synced 2025-09-25 20:48:32 +00:00
getenv: return NULL if empty #2574
Making an environment variable empty can be a way of unsetting it for platforms that don't support unsetenv(). In most cases, we treat empty variables as having been unset. For all others, use os_env_exists().
This commit is contained in:
@@ -3025,10 +3025,11 @@ char *get_mess_lang(void)
|
||||
# endif
|
||||
# else
|
||||
p = os_getenv("LC_ALL");
|
||||
if (p == NULL || *p == NUL) {
|
||||
if (p == NULL) {
|
||||
p = os_getenv("LC_MESSAGES");
|
||||
if (p == NULL || *p == NUL)
|
||||
if (p == NULL) {
|
||||
p = os_getenv("LANG");
|
||||
}
|
||||
}
|
||||
# endif
|
||||
return p;
|
||||
@@ -3044,15 +3045,17 @@ static char_u *get_mess_env(void)
|
||||
char_u *p;
|
||||
|
||||
p = (char_u *)os_getenv("LC_ALL");
|
||||
if (p == NULL || *p == NUL) {
|
||||
if (p == NULL) {
|
||||
p = (char_u *)os_getenv("LC_MESSAGES");
|
||||
if (p == NULL || *p == NUL) {
|
||||
if (p == NULL) {
|
||||
p = (char_u *)os_getenv("LANG");
|
||||
if (p != NULL && ascii_isdigit(*p))
|
||||
if (p != NULL && ascii_isdigit(*p)) {
|
||||
p = NULL; /* ignore something like "1043" */
|
||||
}
|
||||
# ifdef HAVE_GET_LOCALE_VAL
|
||||
if (p == NULL || *p == NUL)
|
||||
if (p == NULL) {
|
||||
p = (char_u *)get_locale_val(LC_CTYPE);
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user