[Qemu-devel] [PATCH 31/31] vl: Simplify call of parse_name()

Markus Armbruster posted 31 patches 7 years ago
There is a newer version of this series
[Qemu-devel] [PATCH 31/31] vl: Simplify call of parse_name()
Posted by Markus Armbruster 7 years ago
main() checks for parse_name() failure even though it can't actually
fail.  That's okay.  Simplify it to check by passing &error_fatal,
like the other users of qemu_opts_foreach().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 vl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/vl.c b/vl.c
index 101e0123d9..0a76c58943 100644
--- a/vl.c
+++ b/vl.c
@@ -3926,10 +3926,8 @@ int main(int argc, char **argv, char **envp)
     }
 #endif
 
-    if (qemu_opts_foreach(qemu_find_opts("name"),
-                          parse_name, NULL, NULL)) {
-        exit(1);
-    }
+    qemu_opts_foreach(qemu_find_opts("name"),
+                      parse_name, NULL, &error_fatal);
 
 #ifndef _WIN32
     qemu_opts_foreach(qemu_find_opts("add-fd"),
-- 
2.17.1


Re: [Qemu-devel] [PATCH 31/31] vl: Simplify call of parse_name()
Posted by Philippe Mathieu-Daudé 7 years ago
On 08/10/2018 19:31, Markus Armbruster wrote:
> main() checks for parse_name() failure even though it can't actually
> fail.  That's okay.  Simplify it to check by passing &error_fatal,
> like the other users of qemu_opts_foreach().
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  vl.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index 101e0123d9..0a76c58943 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3926,10 +3926,8 @@ int main(int argc, char **argv, char **envp)
>      }
>  #endif
>  
> -    if (qemu_opts_foreach(qemu_find_opts("name"),
> -                          parse_name, NULL, NULL)) {
> -        exit(1);
> -    }
> +    qemu_opts_foreach(qemu_find_opts("name"),
> +                      parse_name, NULL, &error_fatal);
>  
>  #ifndef _WIN32
>      qemu_opts_foreach(qemu_find_opts("add-fd"),
>