aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-03 10:22:11 +0800
committerGitHub <noreply@github.com>2024-02-03 10:22:11 +0800
commit9ab9cde2ca7b917a894068698ef2fec3a851fdd5 (patch)
tree8ed12c4c073cfb8ff25e062cbbbdc63a9feecd84 /src/nvim/os
parent1f40b4e22232f22551a9ae89a9f8d59b5ba0c0b6 (diff)
downloadrneovim-9ab9cde2ca7b917a894068698ef2fec3a851fdd5.tar.gz
rneovim-9ab9cde2ca7b917a894068698ef2fec3a851fdd5.tar.bz2
rneovim-9ab9cde2ca7b917a894068698ef2fec3a851fdd5.zip
vim-patch:partial:9.0.1196: code is indented more than necessary (#27315)
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes vim/vim#11813) https://github.com/vim/vim/commit/e8575988969579f9e1439181ae338b2ff74054a8 Skip list_alloc_with_items(). Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/lang.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/nvim/os/lang.c b/src/nvim/os/lang.c
index f1e23fa543..fb534ab2f4 100644
--- a/src/nvim/os/lang.c
+++ b/src/nvim/os/lang.c
@@ -80,17 +80,21 @@ static char *get_mess_env(void)
return get_locale_val(LC_MESSAGES);
#else
char *p = (char *)os_getenv("LC_ALL");
+ if (p != NULL) {
+ return p;
+ }
+
+ p = (char *)os_getenv("LC_MESSAGES");
+ if (p != NULL) {
+ return p;
+ }
+
+ p = (char *)os_getenv("LANG");
+ if (p != NULL && ascii_isdigit(*p)) {
+ p = NULL; // ignore something like "1043"
+ }
if (p == NULL) {
- p = (char *)os_getenv("LC_MESSAGES");
- if (p == NULL) {
- p = (char *)os_getenv("LANG");
- if (p != NULL && ascii_isdigit(*p)) {
- p = NULL; // ignore something like "1043"
- }
- if (p == NULL) {
- p = get_locale_val(LC_CTYPE);
- }
- }
+ p = get_locale_val(LC_CTYPE);
}
return p;
#endif