comparison 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
comparison
equal deleted inserted replaced
31751:997105f91449 31752:3365a601e73b
566 * Sets LANG environment variable in Vim from Mac locale 566 * Sets LANG environment variable in Vim from Mac locale
567 */ 567 */
568 void 568 void
569 mac_lang_init(void) 569 mac_lang_init(void)
570 { 570 {
571 if (mch_getenv((char_u *)"LANG") == NULL) 571 if (mch_getenv((char_u *)"LANG") != NULL)
572 { 572 return;
573 char buf[50]; 573
574 574 char buf[50];
575 // $LANG is not set, either because it was unset or Vim was started 575
576 // from the Dock. Query the system locale. 576 // $LANG is not set, either because it was unset or Vim was started
577 if (LocaleRefGetPartString(NULL, 577 // from the Dock. Query the system locale.
578 kLocaleLanguageMask | kLocaleLanguageVariantMask | 578 if (LocaleRefGetPartString(NULL,
579 kLocaleRegionMask | kLocaleRegionVariantMask, 579 kLocaleLanguageMask | kLocaleLanguageVariantMask |
580 sizeof(buf) - 10, buf) == noErr && *buf) 580 kLocaleRegionMask | kLocaleRegionVariantMask,
581 { 581 sizeof(buf) - 10, buf) == noErr && *buf)
582 if (strcasestr(buf, "utf-8") == NULL) 582 {
583 strcat(buf, ".UTF-8"); 583 if (strcasestr(buf, "utf-8") == NULL)
584 vim_setenv((char_u *)"LANG", (char_u *)buf); 584 strcat(buf, ".UTF-8");
585 vim_setenv((char_u *)"LANG", (char_u *)buf);
585 # ifdef HAVE_LOCALE_H 586 # ifdef HAVE_LOCALE_H
586 setlocale(LC_ALL, ""); 587 setlocale(LC_ALL, "");
587 # endif 588 # endif
588 # if defined(LC_NUMERIC) 589 # if defined(LC_NUMERIC)
589 // Make sure strtod() uses a decimal point, not a comma. 590 // Make sure strtod() uses a decimal point, not a comma.
590 setlocale(LC_NUMERIC, "C"); 591 setlocale(LC_NUMERIC, "C");
591 # endif 592 # endif
592 }
593 } 593 }
594 } 594 }
595 #endif // MACOS_CONVERT 595 #endif // MACOS_CONVERT