mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-27 10:50:57 +01:00
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.
This commit is contained in:
parent
b1d238bbb8
commit
b5fb246a99
1 changed files with 4 additions and 4 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue