mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
[v0.88][ARM][BUGFIX] Fix bugs in single CPU SoCs and small bugs related to strings
This commit is contained in:
@@ -150,12 +150,15 @@ char* get_str_freq(struct frequency* freq) {
|
||||
uint32_t size = (4+3+1);
|
||||
assert(strlen(STRING_UNKNOWN)+1 <= size);
|
||||
char* string = malloc(sizeof(char)*size);
|
||||
memset(string, 0, sizeof(char)*size);
|
||||
|
||||
if(freq->max == UNKNOWN_FREQ)
|
||||
snprintf(string,strlen(STRING_UNKNOWN)+1,STRING_UNKNOWN);
|
||||
else if(freq->max >= 1000)
|
||||
snprintf(string,size,"%.2f"STRING_GIGAHERZ,(float)(freq->max)/1000);
|
||||
else
|
||||
snprintf(string,size,"%.2f"STRING_MEGAHERZ,(float)(freq->max));
|
||||
snprintf(string,size,"%lld"STRING_MEGAHERZ,freq->max);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
@@ -563,13 +563,7 @@ bool print_cpufetch_arm(struct ascii* art, struct cpuInfo* cpu, struct colors* c
|
||||
setAttribute(art,ATTRIBUTE_L2,l2);
|
||||
if(l3 != NULL) {
|
||||
setAttribute(art,ATTRIBUTE_L3,l3);
|
||||
free(l3);
|
||||
}
|
||||
|
||||
free(max_frequency);
|
||||
free(l1i);
|
||||
free(l1d);
|
||||
free(l2);
|
||||
}
|
||||
else {
|
||||
struct cpuInfo* ptr = cpu;
|
||||
|
||||
@@ -129,6 +129,7 @@ int get_ncores_from_cpuinfo() {
|
||||
char* tmp1 = strstr(buf, "-") + 1;
|
||||
char* tmp2 = strstr(buf, "\n");
|
||||
char ncores_str[offset];
|
||||
memset(ncores_str, 0, sizeof(char) * offset);
|
||||
memcpy(ncores_str, tmp1, tmp2-tmp1);
|
||||
|
||||
char* end;
|
||||
|
||||
Reference in New Issue
Block a user