qemu-devel
[Top][All Lists]
Advanced

[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: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 2/2] vl.c: allocate TYPE_MACHINE list once during bootup
Date: Wed, 03 Apr 2019 08:15:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Wei Yang <address@hidden> writes:

> 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.

You're right, I overlooked that use of @machines.  Keep your patch as it
is.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]