qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vl.c: remove duplicate call to qemu_get_machine


From: Marcel Apfelbaum
Subject: Re: [Qemu-devel] [PATCH] vl.c: remove duplicate call to qemu_get_machine_opts
Date: Mon, 8 Feb 2016 14:27:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 02/08/2016 02:22 PM, Laszlo Ersek wrote:
On 02/08/16 12:45, Marcel Apfelbaum wrote:
Also we can use current machine properties instead of querying machine's opts.

Why? :) For me at least, you'll have to spell it out.

The theory would be that is cleaner to call an object property than use a string
(when possible); compiler helps and so on...

  object->prop vs find_me_prop("prop")

Since all machine properties have already been set with the command line options
we really have no need to use them anymore and we can favor the machine.

Thanks,
Marcel


Thanks
Laszlo


Signed-off-by: Marcel Apfelbaum <address@hidden>
---
  vl.c | 9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/vl.c b/vl.c
index 5873248..c03a4fe 100644
--- a/vl.c
+++ b/vl.c
@@ -4353,11 +4353,10 @@ int main(int argc, char **argv, char **envp)
          qtest_init(qtest_chrdev, qtest_log, &error_fatal);
      }

-    machine_opts = qemu_get_machine_opts();
-    kernel_filename = qemu_opt_get(machine_opts, "kernel");
-    initrd_filename = qemu_opt_get(machine_opts, "initrd");
-    kernel_cmdline = qemu_opt_get(machine_opts, "append");
-    bios_name = qemu_opt_get(machine_opts, "firmware");
+    kernel_filename = current_machine->kernel_filename;
+    initrd_filename = current_machine->initrd_filename;
+    kernel_cmdline = current_machine->kernel_cmdline;
+    bios_name = current_machine->firmware;

      opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
      if (opts) {


Thanks
Laszlo





reply via email to

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