From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDc8W-0007iv-St for qemu-devel@nongnu.org; Tue, 20 Jan 2015 11:58:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDc8S-0006lU-KX for qemu-devel@nongnu.org; Tue, 20 Jan 2015 11:58:40 -0500 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:36184 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDc8S-0006lO-EK for qemu-devel@nongnu.org; Tue, 20 Jan 2015 11:58:36 -0500 References: <1421706621-23731-1-git-send-email-greg.bellows@linaro.org> <1421706621-23731-3-git-send-email-greg.bellows@linaro.org> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1421706621-23731-3-git-send-email-greg.bellows@linaro.org> Date: Tue, 20 Jan 2015 16:58:35 +0000 Message-ID: <87y4ox75j8.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 2/5] target-arm: Add feature parsing to virt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Bellows Cc: peter.maydell@linaro.org, qemu-devel@nongnu.org, christoffer.dall@linaro.org Greg Bellows writes: > Added machvirt parsing of feature keywords added to the -cpu command line > option. Parsing occurs during machine initialization. > > Signed-off-by: Greg Bellows > --- > hw/arm/virt.c | 21 +++++++++++++++++++-- > 1 file changed, 19 insertions(+), 2 deletions(-) > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > index 2353440..cd192ae 100644 > --- a/hw/arm/virt.c > +++ b/hw/arm/virt.c > @@ -573,12 +573,19 @@ static void machvirt_init(MachineState *machine) > MemoryRegion *ram = g_new(MemoryRegion, 1); > const char *cpu_model = machine->cpu_model; > VirtBoardInfo *vbi; > + char *cpuname, *features; > > if (!cpu_model) { > cpu_model = "cortex-a15"; > } > > - vbi = find_machine_info(cpu_model); > + /* Separate the actual CPU model name from any appended features */ > + cpuname = g_strdup(cpu_model); > + cpuname = strtok(cpuname, ","); > + /* Keep track of the features for later parsing */ > + features = strtok(NULL, ","); OK having read the strtok man page a bit more closely the second time I'm happy this doesn't leak. My more-gliby request is a matter of personal taste. -- Alex Bennée