mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 16:00:39 +01:00
Fix bug: remove spaces between CPU name in certain processors
This commit is contained in:
@@ -8,7 +8,7 @@ char* get_str_cpu_name() {
|
|||||||
unsigned int ecx = 0;
|
unsigned int ecx = 0;
|
||||||
unsigned int edx = 0;
|
unsigned int edx = 0;
|
||||||
|
|
||||||
char name[64];
|
char *name = malloc(sizeof(char)*64);
|
||||||
memset(name, 0, 64);
|
memset(name, 0, 64);
|
||||||
|
|
||||||
//First, check we can use extended
|
//First, check we can use extended
|
||||||
@@ -85,10 +85,13 @@ char* get_str_cpu_name() {
|
|||||||
name[__COUNTER__] = '\0';
|
name[__COUNTER__] = '\0';
|
||||||
|
|
||||||
//Remove unused characters
|
//Remove unused characters
|
||||||
int i = 0;
|
char *str = name;
|
||||||
while(name[i] == ' ')i++;
|
char *dest = name;
|
||||||
|
while (*str != '\0') {
|
||||||
char* name_withoutblank = malloc(sizeof(char)*64);
|
while (*str == ' ' && *(str + 1) == ' ') str++;
|
||||||
strcpy(name_withoutblank,name+i);
|
*dest++ = *str++;
|
||||||
return name_withoutblank;
|
}
|
||||||
|
*dest = '\0';
|
||||||
|
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user