From 214aac6fd60747c0cd9fae1783b1ba343aaf47a8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 9 Mar 2017 18:02:14 +0100 Subject: [PATCH] Avoid calling wxGetenv() twice unnecessarily Use wxGetEnv() helper function which allows to write the code in more natural and (slightly) more efficient way. No real changes. --- src/unix/stdpaths.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/unix/stdpaths.cpp b/src/unix/stdpaths.cpp index 51722274ab..b6d9aa20bd 100644 --- a/src/unix/stdpaths.cpp +++ b/src/unix/stdpaths.cpp @@ -268,13 +268,14 @@ wxString wxStandardPaths::GetUserDir(Dir userDir) const // the version of wxWidgets used by the application. wxLogNull logNull; - wxString homeDir = wxFileName::GetHomeDir(); + const wxString homeDir = wxFileName::GetHomeDir(); if (userDir == Dir_Cache) { - if (wxGetenv(wxT("XDG_CACHE_HOME"))) - return wxGetenv(wxT("XDG_CACHE_HOME")); - else - return homeDir + wxT("/.cache"); + wxString cacheDir; + if ( !wxGetEnv(wxS("XDG_CACHE_HOME"), &cacheDir) ) + cacheDir = homeDir + wxS("/.cache"); + + return cacheDir; } wxString dirsFile = GetXDGConfigHome() + wxT("/user-dirs.dirs");