From ae916d47e3cf2cbf05edd652a6dd0d85b93685a7 Mon Sep 17 00:00:00 2001 From: Drath Vader Date: Fri, 28 Nov 2025 01:43:59 +0100 Subject: [PATCH] use string pointers, no copy --- include/sys.hpp | 4 ++-- src/sys.cpp | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/sys.hpp b/include/sys.hpp index f10c46b..a435ed8 100644 --- a/include/sys.hpp +++ b/include/sys.hpp @@ -39,8 +39,8 @@ struct Network { void getTimeDate(TimeDate* td); void getDisk(Disk* disk); void getRam(Memory* mem); -void getNetwork(Network* net, std::string device); -void detectHwmon(sysSensors* s, std::string platform); +void getNetwork(Network* net, const std::string& device); +void detectHwmon(sysSensors* s, const std::string& platform); void updateSensors(sysSensors* s); } // namespace sys diff --git a/src/sys.cpp b/src/sys.cpp index fea863d..157464e 100644 --- a/src/sys.cpp +++ b/src/sys.cpp @@ -1,7 +1,6 @@ #include #include -#include #include #include #include @@ -31,7 +30,7 @@ void sys::getDisk(Disk* disk) { disk->usage.total = diskData.f_blocks * diskData.f_frsize; } -void sys::getNetwork(Network* net, std::string device) { +void sys::getNetwork(Network* net, const std::string& device) { struct _net { std::chrono::time_point ts; uint64_t rx = 0; @@ -51,7 +50,7 @@ void sys::getNetwork(Network* net, std::string device) { prev = current; } -void sys::detectHwmon(sysSensors* s, std::string platform) { +void sys::detectHwmon(sysSensors* s, const std::string& platform) { s->hwmon = getFirstDir("/sys/devices/platform/" + platform + "/hwmon"); }