mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +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 edx = 0;
|
||||
|
||||
char name[64];
|
||||
char *name = malloc(sizeof(char)*64);
|
||||
memset(name, 0, 64);
|
||||
|
||||
//First, check we can use extended
|
||||
@@ -85,10 +85,13 @@ char* get_str_cpu_name() {
|
||||
name[__COUNTER__] = '\0';
|
||||
|
||||
//Remove unused characters
|
||||
int i = 0;
|
||||
while(name[i] == ' ')i++;
|
||||
|
||||
char* name_withoutblank = malloc(sizeof(char)*64);
|
||||
strcpy(name_withoutblank,name+i);
|
||||
return name_withoutblank;
|
||||
char *str = name;
|
||||
char *dest = name;
|
||||
while (*str != '\0') {
|
||||
while (*str == ' ' && *(str + 1) == ' ') str++;
|
||||
*dest++ = *str++;
|
||||
}
|
||||
*dest = '\0';
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user