From b5fb246a99962b69079a6742b602d58a3f15a843 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 20 Aug 2018 20:06:22 -0400 Subject: telemetry_session: Don't allocate std::string instances for program lifetime in GetTelemetryId() and RegenerateTelemetryId() Given these functions aren't intended to be used frequently, there's no need to keep the std::string instances allocated for the whole lifetime of the program. It's just a waste of memory. --- src/core/telemetry_session.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 7e4584fc2..69383330f 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -19,8 +19,8 @@ static u64 GenerateTelemetryId() { u64 GetTelemetryId() { u64 telemetry_id{}; - static const std::string& filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + - "telemetry_id"}; + const std::string filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + + "telemetry_id"}; if (FileUtil::Exists(filename)) { FileUtil::IOFile file(filename, "rb"); @@ -44,8 +44,8 @@ u64 GetTelemetryId() { u64 RegenerateTelemetryId() { const u64 new_telemetry_id{GenerateTelemetryId()}; - static const std::string& filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + - "telemetry_id"}; + const std::string filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + + "telemetry_id"}; FileUtil::IOFile file(filename, "wb"); if (!file.IsOpen()) { -- cgit v1.2.3