mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
Fixed little bug in cache print and changed message when no cache level was found
This commit is contained in:
34
udev.c
34
udev.c
@@ -115,19 +115,33 @@ char* getString_L1(struct cache* cach) {
|
||||
}
|
||||
|
||||
char* getString_L2(struct cache* cach) {
|
||||
//Max 4 digits and 2 for 'KB'
|
||||
int size = (4+2+1);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
snprintf(string,size,"%dKB",cach->L2/1024);
|
||||
return string;
|
||||
if(cach->L2 == NO_CACHE) {
|
||||
char* string = malloc(sizeof(char)*5);
|
||||
snprintf(string,5,"None");
|
||||
return string;
|
||||
}
|
||||
else {
|
||||
//Max 4 digits and 2 for 'KB'
|
||||
int size = (4+2+1);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
snprintf(string,size,"%dKB",cach->L2/1024);
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
char* getString_L3(struct cache* cach) {
|
||||
//Max 4 digits and 2 for 'KB'
|
||||
int size = (4+2+1);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
snprintf(string,size,"%dKB",cach->L3/1024);
|
||||
return string;
|
||||
if(cach->L3 == NO_CACHE) {
|
||||
char* string = malloc(sizeof(char)*5);
|
||||
snprintf(string,5,"None");
|
||||
return string;
|
||||
}
|
||||
else {
|
||||
//Max 4 digits and 2 for 'KB'
|
||||
int size = (4+2+1);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
snprintf(string,size,"%dKB",cach->L3/1024);
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
char* getString_MaxFrequency(struct frequency* freq) {
|
||||
|
||||
Reference in New Issue
Block a user