From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sx8DH-0004pc-8f for qemu-devel@nongnu.org; Thu, 02 Aug 2012 23:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sx8DE-0006Ai-OL for qemu-devel@nongnu.org; Thu, 02 Aug 2012 23:06:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sx8DE-0006AL-Fs for qemu-devel@nongnu.org; Thu, 02 Aug 2012 23:06:04 -0400 From: Eduardo Habkost Date: Thu, 2 Aug 2012 23:59:13 -0300 Message-Id: <1343962766-22024-7-git-send-email-ehabkost@redhat.com> In-Reply-To: <1343962766-22024-1-git-send-email-ehabkost@redhat.com> References: <1343962766-22024-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [RFC 06/19] i386: cpu: extract the full feature list before parsing it List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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; -- 1.7.11.2