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)
diff --git a/src/os_mac_conv.c b/src/os_mac_conv.c
index a699ce0..18e5547 100644
--- a/src/os_mac_conv.c
+++ b/src/os_mac_conv.c
@@ -568,28 +568,28 @@
void
mac_lang_init(void)
{
- if (mch_getenv((char_u *)"LANG") == NULL)
- {
- char buf[50];
+ if (mch_getenv((char_u *)"LANG") != NULL)
+ return;
- // $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);
+ 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);
# 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