Browse Source
Merge pull request #1126 from lioncash/telem
telemetry_session: Don't allocate std::string instances for program lifetime in GetTelemetryId() and RegenerateTelemetryId()
pull/15/merge
bunnei
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
4 deletions
-
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()) { |
|
|
|
|