From 40686cc1869953a42f311b6d8a3558e99acef37d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 16 Feb 2020 14:35:10 +0300 Subject: useless checks removed --- plugins/TrafficCounter/src/statistics.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'plugins/TrafficCounter/src') diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index a0872b769e..b97e34b7b1 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -296,13 +296,14 @@ void Stat_ReadFile(PROTOLIST &p) { LARGE_INTEGER Size; DWORD BytesRead; - wchar_t FileName[MAX_PATH], *pszPath; - SYSTEMTIME stNow; + wchar_t FileName[MAX_PATH]; + { + VARSW pszPath(Utils_ReplaceVarsW(L"%miranda_userdata%\\statistics")); + CreateDirectoryTreeW(pszPath); + mir_snwprintf(FileName, L"%s\\%S.stat", pszPath.get(), p.name); + } - pszPath = Utils_ReplaceVarsW(L"%miranda_userdata%\\statistics"); - CreateDirectoryTreeW(pszPath); - mir_snwprintf(FileName, L"%s\\%S.stat", pszPath, p.name); - mir_free(pszPath); + SYSTEMTIME stNow; GetLocalTime(&stNow); p.hFile = CreateFile(FileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); -- cgit v1.2.3