On Tue, Apr 02, 2019 at 06:10:23PM +0200, Markus Armbruster wrote: >Wei Yang <richard.weiy...@gmail.com> 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