use string pointers, no copy

This commit is contained in:
Drath Vader
2025-11-28 01:43:59 +01:00
parent 47b9572620
commit ae916d47e3
2 changed files with 4 additions and 5 deletions

View File

@@ -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

View File

@@ -1,7 +1,6 @@
#include <sys/statvfs.h>
#include <chrono>
#include <cwchar>
#include <format>
#include <string>
#include <sys.hpp>
@@ -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<std::chrono::steady_clock> 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");
}