citra-emu
/
citra-canary
Archived
1
0
Fork 0

Merge pull request #4162 from FearlessTobi/port-1126

Port yuzu-emu/yuzu#1126 from yuzu: "Don't allocate std::string instances for program lifetime in GetTelemetryId() and RegenerateTelemetryId()"
This commit is contained in:
Pengfei Zhu 2018-08-31 17:39:49 +08:00 committed by GitHub
commit 13f2cc9964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ static u64 GenerateTelemetryId() {
u64 GetTelemetryId() {
u64 telemetry_id{};
static const std::string& filename{FileUtil::GetUserPath(D_CONFIG_IDX) + "telemetry_id"};
const std::string filename{FileUtil::GetUserPath(D_CONFIG_IDX) + "telemetry_id"};
if (FileUtil::Exists(filename)) {
FileUtil::IOFile file(filename, "rb");
@ -69,7 +69,7 @@ u64 GetTelemetryId() {
u64 RegenerateTelemetryId() {
const u64 new_telemetry_id{GenerateTelemetryId()};
static const std::string& filename{FileUtil::GetUserPath(D_CONFIG_IDX) + "telemetry_id"};
const std::string filename{FileUtil::GetUserPath(D_CONFIG_IDX) + "telemetry_id"};
FileUtil::IOFile file(filename, "wb");
if (!file.IsOpen()) {