From 2d170d1bb6068862882fd9d63cf2946efe736219 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Jul 2017 18:56:15 +0200 Subject: [PATCH] Get rid of common "locale" variable in wxLocale::Init() Try to make code less confusing by avoiding defining a variable in platform-independent part of the code and then actually using it only in platform-specific code. --- src/common/intl.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 448422f902..45c8255f43 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -420,11 +420,10 @@ bool wxLocale::Init(int language, int flags) wxString name = info->Description; wxString canonical = info->CanonicalName; - wxString locale; // Set the locale: #if defined(__UNIX__) && !defined(__WXMAC__) - locale = info->CanonicalName; + const wxString& locale = info->CanonicalName; const char *retloc = wxSetlocaleTryUTF8(LC_ALL, locale); @@ -522,7 +521,7 @@ bool wxLocale::Init(int language, int flags) } // and also call setlocale() to change locale used by the CRT - locale = info->GetLocaleName(); + const wxString locale = info->GetLocaleName(); if ( locale.empty() ) { ret = false; @@ -551,7 +550,7 @@ bool wxLocale::Init(int language, int flags) if ( !retloc ) ret = false; #elif defined(__WXMAC__) - locale = info->CanonicalName; + const wxString& locale = info->CanonicalName; const char *retloc = wxSetlocale(LC_ALL, locale);