[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/2] vl.c: allocate TYPE_MACHINE list once durin
From: |
Wei Yang |
Subject: |
Re: [Qemu-devel] [PATCH 2/2] vl.c: allocate TYPE_MACHINE list once during bootup |
Date: |
Wed, 3 Apr 2019 08:49:07 +0800 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Apr 02, 2019 at 06:10:23PM +0200, Markus Armbruster wrote:
>Wei Yang <address@hidden> writes:
[...]
>>>>
>>>> @@ -2659,7 +2655,8 @@ static const QEMUOption *lookup_opt(int argc, char
>>>> **argv,
>>>>
>>>> static MachineClass *select_machine(void)
>>>> {
>>>> - MachineClass *machine_class = find_default_machine();
>>>> + GSList *machines = object_class_get_list(TYPE_MACHINE, false);
>>>> + MachineClass *machine_class = find_default_machine(machines);
>>>> const char *optarg;
>>>> QemuOpts *opts;
>>>> Location loc;
>>>> @@ -2671,7 +2668,7 @@ static MachineClass *select_machine(void)
>>>>
>>>> optarg = qemu_opt_get(opts, "type");
>>>> if (optarg) {
>>>> - machine_class = machine_parse(optarg);
>>>> + machine_class = machine_parse(optarg, machines);
>>>
>>>Could create and destroy @machines here:
>>>
>>> - machine_class = machine_parse(optarg);
>>> + GSList *machines = object_class_get_list(TYPE_MACHINE, false);
>>> + machine_class = machine_parse(optarg, machines);
>>> + g_slist_free(machines);
>>>
>>>Matter of taste.
>
>[*]
>
>Matter of taste means the choice between your version and mine is up to
>the maintainer, or if the maintainer remains silent, up to you.
>
Ok, I get your meaning.
But machines should be used in find_default_machine(), after move the
allocation in "if", would there be a problem?
I may not understand your point here.
--
Wei Yang
Help you, Help me