Skip to content
Snippets Groups Projects
Commit af17c09e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

linux: allow variable tabbing in cpuinfo

The number of tabulation character can vary with versions. Case in
point, RISC-V started with one tabluration, but has two in more recent
kernel versions, to maintain visual alignment.
parent 2188dd74
No related branches found
No related tags found
1 merge request!1321RISC-V Vector Extension support
......@@ -29,13 +29,13 @@
#undef CPU_FLAGS
#if defined (__arm__) || defined (__aarch64__)
# define CPU_FLAGS "Features\t:"
# define CPU_FLAGS "Features"
#elif defined (__i386__) || defined (__x86_64__)
# define CPU_FLAGS "flags\t\t:"
# define CPU_FLAGS "flags"
#elif defined (__powerpc__) || defined (__powerpc64__)
# define CPU_FLAGS "cpu\t\t:"
# define CPU_FLAGS "cpu"
#endif
......@@ -52,7 +52,7 @@ unsigned vlc_CPU_raw(void)
while (getline (&line, &linelen, info) != -1)
{
char *p = line, *cap;
char *p, *cap;
uint_fast32_t core_caps = 0;
#if defined (__arm__)
......@@ -63,6 +63,11 @@ unsigned vlc_CPU_raw(void)
if (strncmp (line, CPU_FLAGS, strlen (CPU_FLAGS)))
continue;
p = line + strlen(CPU_FLAGS);
p += strspn(p, "\t");
if (*p != ':')
continue;
while ((cap = strsep (&p, " ")) != NULL)
{
#if defined (__arm__) || defined (__aarch64__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment