diff options
| author | 2018-08-20 20:06:22 -0400 | |
|---|---|---|
| committer | 2018-08-20 20:06:25 -0400 | |
| commit | b5fb246a99962b69079a6742b602d58a3f15a843 (patch) | |
| tree | fe2bf37d59c323ad20ba6cb5951762d56414987b /src/core/telemetry_session.cpp | |
| parent | Merge pull request #1064 from lioncash/telemetry (diff) | |
| download | yuzu-b5fb246a99962b69079a6742b602d58a3f15a843.tar.gz yuzu-b5fb246a99962b69079a6742b602d58a3f15a843.tar.xz yuzu-b5fb246a99962b69079a6742b602d58a3f15a843.zip | |
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.
Diffstat (limited to 'src/core/telemetry_session.cpp')
| -rw-r--r-- | src/core/telemetry_session.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
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() { | |||
| 19 | 19 | ||
| 20 | u64 GetTelemetryId() { | 20 | u64 GetTelemetryId() { |
| 21 | u64 telemetry_id{}; | 21 | u64 telemetry_id{}; |
| 22 | static const std::string& filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + | 22 | const std::string filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + |
| 23 | "telemetry_id"}; | 23 | "telemetry_id"}; |
| 24 | 24 | ||
| 25 | if (FileUtil::Exists(filename)) { | 25 | if (FileUtil::Exists(filename)) { |
| 26 | FileUtil::IOFile file(filename, "rb"); | 26 | FileUtil::IOFile file(filename, "rb"); |
| @@ -44,8 +44,8 @@ u64 GetTelemetryId() { | |||
| 44 | 44 | ||
| 45 | u64 RegenerateTelemetryId() { | 45 | u64 RegenerateTelemetryId() { |
| 46 | const u64 new_telemetry_id{GenerateTelemetryId()}; | 46 | const u64 new_telemetry_id{GenerateTelemetryId()}; |
| 47 | static const std::string& filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + | 47 | const std::string filename{FileUtil::GetUserPath(FileUtil::UserPath::ConfigDir) + |
| 48 | "telemetry_id"}; | 48 | "telemetry_id"}; |
| 49 | 49 | ||
| 50 | FileUtil::IOFile file(filename, "wb"); | 50 | FileUtil::IOFile file(filename, "wb"); |
| 51 | if (!file.IsOpen()) { | 51 | if (!file.IsOpen()) { |