[optimization] pass by value instead of global values

This commit is contained in:
Abdellah El Morabit 2025-10-14 10:02:25 +02:00
parent e0a44b9c2b
commit 123e2a77c8
3 changed files with 33 additions and 8 deletions

View File

@ -27,17 +27,24 @@ void av_mem_size();
void device_up_time();
void device_os_version();
void device_hostname();
void device_model();
cpu_s _cpu;
ram_s _ram;
disk_s _disk;
device_s _device;
void init_device();
#ifdef __gnu_linux__
#include <sys/sysinfo.h>
void init_device() {
device_s _device;
_device.&name = device_model();
_device.&hostname =
}
void cpu_name(){
int buffer_size = 256;
char cpu_name[buffer_size];
@ -329,6 +336,15 @@ void device_os_version() {
}
void init_device() {
device_s _device;
_device.name = device_model();
_device.hostname =
}
#endif

View File

@ -1,9 +1,10 @@
#ifndef LIB_H
#define LIB_H
#include "types.h"
#ifdef __APPLE__
void cpu_name();
void cpu_name(cpu_s cpu);
void cpu_threads();
void cpu_temperature();
void cpu_frequency();

View File

@ -21,9 +21,17 @@ typedef struct {
} disk_s;
typedef struct {
char* name;
char* hostname;
char* os_version;
char *name;
char *hostname;
char *os_version;
int uptime;
cpu_s cpu;
ram_s ram;
disk_s disk;
} device_s;
#endif