Greg Bellows <greg.bell...@linaro.org> writes: > Added machvirt parsing of feature keywords added to the -cpu command line > option. Parsing occurs during machine initialization. > > Signed-off-by: Greg Bellows <greg.bell...@linaro.org> > --- > 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, ","); <snip>
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