use string pointers, no copy
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user