qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 06/19] i386: cpu: extract the full feature list before


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 06/19] i386: cpu: extract the full feature list before parsing it
Date: Thu, 2 Aug 2012 23:59:13 -0300

The parsing of the feature list string will be moved to a separate
function, so first extract the full feature list, then parse it.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 target-i386/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 154a01f..7af80a0 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -1086,6 +1086,8 @@ static int cpu_x86_build_from_name(x86_def_t *x86_cpu_def,
     char *last;
     char *s = g_strdup(cpu_model);
     char *featurestr, *name = strtok_r(s, ",", &last);
+    char *featlist = strtok_r(NULL, "", &last);
+
     /* Features to be added*/
     uint32_t plus_features = 0, plus_ext_features = 0;
     uint32_t plus_ext2_features = 0, plus_ext3_features = 0;
@@ -1116,7 +1118,7 @@ static int cpu_x86_build_from_name(x86_def_t *x86_cpu_def,
         &plus_ext_features, &plus_ext2_features, &plus_ext3_features,
         &plus_kvm_features, &plus_svm_features);
 
-    featurestr = strtok_r(NULL, ",", &last);
+    featurestr = featlist ? strtok_r(featlist, ",", &last) : NULL;
 
     while (featurestr) {
         char *val;
-- 
1.7.11.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]