mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
[v0.98][Refactoring] Unify the use of unknown string
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
#include "uarch.h"
|
||||
#include "soc.h"
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
void init_cache_struct(struct cache* cach) {
|
||||
cach->L1i = emalloc(sizeof(struct cach));
|
||||
cach->L1d = emalloc(sizeof(struct cach));
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "../common/global.h"
|
||||
|
||||
#define min(a,b) (((a)<(b))?(a):(b))
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
static char* soc_trademark_string[] = {
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
#include "uarch.h"
|
||||
#include "../common/global.h"
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
// Data not available
|
||||
#define NA -1
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include "../arm/uarch.h"
|
||||
#endif
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
#define STRING_YES "Yes"
|
||||
#define STRING_NO "No"
|
||||
#define STRING_NONE "None"
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
void set_log_level(bool verbose);
|
||||
void printWarn(const char *fmt, ...);
|
||||
void printErr(const char *fmt, ...);
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "../common/udev.h"
|
||||
#include "../common/global.h"
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
void init_topology_struct(struct topology* topo, struct cache* cach) {
|
||||
topo->total_cores = 0;
|
||||
topo->physical_cores = 0;
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
typedef uint32_t MICROARCH;
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
// Data not available
|
||||
#define NA -1
|
||||
|
||||
@@ -69,7 +67,7 @@ void fill_uarch(struct uarch* arch, MICROARCH u) {
|
||||
bool fill = false;
|
||||
|
||||
FILL_START
|
||||
FILL_UARCH(arch->uarch, UARCH_UNKNOWN, "Unknown", UNK)
|
||||
FILL_UARCH(arch->uarch, UARCH_UNKNOWN, STRING_UNKNOWN, UNK)
|
||||
FILL_UARCH(arch->uarch, UARCH_PPC604, "PowerPC 604", 500)
|
||||
FILL_UARCH(arch->uarch, UARCH_PPCG3, "PowerPC G3", UNK) // varies
|
||||
FILL_UARCH(arch->uarch, UARCH_PPCG4, "PowerPC G4", UNK) // varies
|
||||
|
||||
@@ -37,11 +37,9 @@ static char *hv_vendors_name[] = {
|
||||
[HV_VENDOR_VMWARE] = "VMware",
|
||||
[HV_VENDOR_XEN] = "Xen",
|
||||
[HV_VENDOR_PARALLELS] = "Parallels",
|
||||
[HV_VENDOR_INVALID] = "Unknown"
|
||||
[HV_VENDOR_INVALID] = STRING_UNKNOWN
|
||||
};
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
#define HYPERVISOR_NAME_MAX_LENGTH 17
|
||||
|
||||
#define MASK 0xFF
|
||||
@@ -305,8 +303,8 @@ struct cpuInfo* get_cpu_info() {
|
||||
cpu->cpu_name = get_str_cpu_name_internal();
|
||||
}
|
||||
else {
|
||||
cpu->cpu_name = emalloc(sizeof(char)*8);
|
||||
sprintf(cpu->cpu_name,"Unknown");
|
||||
cpu->cpu_name = emalloc(sizeof(char) * (strlen(STRING_UNKNOWN) + 1));
|
||||
strcpy(cpu->cpu_name, STRING_UNKNOWN);
|
||||
printWarn("Can't read cpu name from cpuid (needed extended level is 0x%.8X, max is 0x%.8X)", 0x80000004, cpu->maxExtendedLevels);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
|
||||
typedef uint32_t MICROARCH;
|
||||
|
||||
#define STRING_UNKNOWN "Unknown"
|
||||
|
||||
// Data not available
|
||||
#define NA -1
|
||||
|
||||
@@ -121,7 +119,7 @@ struct uarch {
|
||||
#define UARCH_START if (false) {}
|
||||
#define CHECK_UARCH(arch, ef_, f_, em_, m_, s_, str, uarch, process) \
|
||||
else if (ef_ == ef && f_ == f && (em_ == NA || em_ == em) && (m_ == NA || m_ == m) && (s_ == NA || s_ == s)) fill_uarch(arch, str, uarch, process);
|
||||
#define UARCH_END else { printBug("Unknown microarchitecture detected: M=0x%.8X EM=0x%.8X F=0x%.8X EF=0x%.8X S=0x%.8X", m, em, f, ef, s); fill_uarch(arch, "Unknown", UARCH_UNKNOWN, 0); }
|
||||
#define UARCH_END else { printBug("Unknown microarchitecture detected: M=0x%.8X EM=0x%.8X F=0x%.8X EF=0x%.8X S=0x%.8X", m, em, f, ef, s); fill_uarch(arch, STRING_UNKNOWN, UARCH_UNKNOWN, 0); }
|
||||
|
||||
void fill_uarch(struct uarch* arch, char* str, MICROARCH u, uint32_t process) {
|
||||
arch->uarch_str = emalloc(sizeof(char) * (strlen(str)+1));
|
||||
|
||||
Reference in New Issue
Block a user