From patchwork Fri Aug 3 02:59:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC, 06/19] i386: cpu: extract the full feature list before parsing it Date: Thu, 02 Aug 2012 16:59:13 -0000 From: Eduardo Habkost X-Patchwork-Id: 174855 Message-Id: <1343962766-22024-7-git-send-email-ehabkost@redhat.com> To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= 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 --- 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;