Mercurial > vim
diff src/os_mac_conv.c @ 31752:3365a601e73b v9.0.1208
patch 9.0.1208: code is indented more than necessary
Commit: https://github.com/vim/vim/commit/a41e221935edab62672a15123af48f4f14ac1c7d
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Mon Jan 16 18:19:05 2023 +0000
patch 9.0.1208: code is indented more than necessary
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11819)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 16 Jan 2023 19:30:04 +0100 |
parents | 029c59bf78f1 |
children | 50555279168b |
line wrap: on
line diff
--- a/src/os_mac_conv.c +++ b/src/os_mac_conv.c @@ -568,28 +568,28 @@ mac_utf8_to_utf16( void mac_lang_init(void) { - if (mch_getenv((char_u *)"LANG") == NULL) - { - char buf[50]; + if (mch_getenv((char_u *)"LANG") != NULL) + return; + + char buf[50]; - // $LANG is not set, either because it was unset or Vim was started - // from the Dock. Query the system locale. - if (LocaleRefGetPartString(NULL, - kLocaleLanguageMask | kLocaleLanguageVariantMask | - kLocaleRegionMask | kLocaleRegionVariantMask, - sizeof(buf) - 10, buf) == noErr && *buf) - { - if (strcasestr(buf, "utf-8") == NULL) - strcat(buf, ".UTF-8"); - vim_setenv((char_u *)"LANG", (char_u *)buf); + // $LANG is not set, either because it was unset or Vim was started + // from the Dock. Query the system locale. + if (LocaleRefGetPartString(NULL, + kLocaleLanguageMask | kLocaleLanguageVariantMask | + kLocaleRegionMask | kLocaleRegionVariantMask, + sizeof(buf) - 10, buf) == noErr && *buf) + { + if (strcasestr(buf, "utf-8") == NULL) + strcat(buf, ".UTF-8"); + vim_setenv((char_u *)"LANG", (char_u *)buf); # ifdef HAVE_LOCALE_H - setlocale(LC_ALL, ""); + setlocale(LC_ALL, ""); # endif # if defined(LC_NUMERIC) - // Make sure strtod() uses a decimal point, not a comma. - setlocale(LC_NUMERIC, "C"); + // Make sure strtod() uses a decimal point, not a comma. + setlocale(LC_NUMERIC, "C"); # endif - } } } #endif // MACOS_CONVERT