1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-16 16:35:45 +00:00

Define constant for CPU codename string

This commit is contained in:
The Tumultuous Unicorn Of Darkness 2023-05-08 22:38:15 +02:00
parent 3dd6974b52
commit df7e310e2f
No known key found for this signature in database
GPG key ID: 1E55EE2EFF18BC1A
4 changed files with 4 additions and 3 deletions

View file

@ -469,7 +469,7 @@ struct cpu_id_t {
* +--------+--------+-------+-------+-------+---------------------------------------+-----------------------+ * +--------+--------+-------+-------+-------+---------------------------------------+-----------------------+
* @endcode * @endcode
*/ */
char cpu_codename[64]; char cpu_codename[CODENAME_STR_MAX];
/** SSE execution unit size (64 or 128; -1 if N/A) */ /** SSE execution unit size (64 or 128; -1 if N/A) */
int32_t sse_size; int32_t sse_size;

View file

@ -34,6 +34,7 @@
#define VENDOR_STR_MAX 16 #define VENDOR_STR_MAX 16
#define BRAND_STR_MAX 64 #define BRAND_STR_MAX 64
#define CODENAME_STR_MAX 64
#define CPU_FLAGS_MAX 128 #define CPU_FLAGS_MAX 128
#define MAX_CPUID_LEVEL 32 #define MAX_CPUID_LEVEL 32
#define MAX_EXT_CPUID_LEVEL 32 #define MAX_EXT_CPUID_LEVEL 32

View file

@ -142,7 +142,7 @@ int match_cpu_codename(const struct match_entry_t* matchtable, int count,
bestindex = i; bestindex = i;
} }
} }
strcpy(data->cpu_codename, matchtable[bestindex].name); strncpy(data->cpu_codename, matchtable[bestindex].name, CODENAME_STR_MAX);
return bestscore; return bestscore;
} }

View file

@ -43,7 +43,7 @@ struct match_entry_t {
int ncores, l2cache, l3cache, brand_code; int ncores, l2cache, l3cache, brand_code;
uint64_t model_bits; uint64_t model_bits;
int model_code; int model_code;
char name[36]; char name[CODENAME_STR_MAX];
}; };
// returns the match score: // returns the match score: