diff mbox series

[v3,39/50] qapi-commands: don't initialize command list in qmp_init_marshall()

Message ID 20170911110623.24981-40-marcandre.lureau@redhat.com
State New
Headers show
Series Hi, | expand

Commit Message

Marc-André Lureau Sept. 11, 2017, 11:06 a.m. UTC
This will let the caller add several list of commands.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 scripts/qapi-commands.py  | 2 --
 monitor.c                 | 1 +
 qga/main.c                | 1 +
 tests/test-qmp-commands.c | 1 +
 4 files changed, 3 insertions(+), 2 deletions(-)

Comments

Markus Armbruster Dec. 13, 2017, 4:23 p.m. UTC | #1
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> This will let the caller add several list of commands.

What for?  I guess that'll become clear later in this series.

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  scripts/qapi-commands.py  | 2 --
>  monitor.c                 | 1 +
>  qga/main.c                | 1 +
>  tests/test-qmp-commands.c | 1 +
>  4 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
> index 8af8d913b9..7455d2b8bb 100644
> --- a/scripts/qapi-commands.py
> +++ b/scripts/qapi-commands.py
> @@ -211,8 +211,6 @@ def gen_registry(registry):
>  
>  void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds)
>  {
> -    QTAILQ_INIT(cmds);
> -
>  ''',
>                  c_prefix=c_name(prefix, protect=False))
>      ret += registry

Please update qapi-code-gen.txt, too.

> diff --git a/monitor.c b/monitor.c
> index b5ddcf8c67..bf8a7685bf 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1001,6 +1001,7 @@ void monitor_init_qmp_commands(void)
>       *   "qmp_capabilities", to enforce capability negotiation
>       */
>  
> +    QTAILQ_INIT(&qmp_commands);
>      qmp_init_marshal(&qmp_commands);
>  
>      qmp_register_command(&qmp_commands, "query-qmp-schema",
> diff --git a/qga/main.c b/qga/main.c
> index 62a62755bd..b949b1ccb0 100644
> --- a/qga/main.c
> +++ b/qga/main.c
> @@ -1360,6 +1360,7 @@ int main(int argc, char **argv)
>  
>      config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;
>  
> +    QTAILQ_INIT(&ga_commands);
>      qga_qmp_init_marshal(&ga_commands);
>  
>      init_dfl_pathnames();
> diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
> index ad7b6e4e1d..28ce88e012 100644
> --- a/tests/test-qmp-commands.c
> +++ b/tests/test-qmp-commands.c
> @@ -283,6 +283,7 @@ int main(int argc, char **argv)
>      g_test_add_func("/0.15/dealloc_types", test_dealloc_types);
>      g_test_add_func("/0.15/dealloc_partial", test_dealloc_partial);
>  
> +    QTAILQ_INIT(&qmp_commands);
>      test_qmp_init_marshal(&qmp_commands);
>      g_test_run();
diff mbox series

Patch

diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index 8af8d913b9..7455d2b8bb 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -211,8 +211,6 @@  def gen_registry(registry):
 
 void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds)
 {
-    QTAILQ_INIT(cmds);
-
 ''',
                 c_prefix=c_name(prefix, protect=False))
     ret += registry
diff --git a/monitor.c b/monitor.c
index b5ddcf8c67..bf8a7685bf 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1001,6 +1001,7 @@  void monitor_init_qmp_commands(void)
      *   "qmp_capabilities", to enforce capability negotiation
      */
 
+    QTAILQ_INIT(&qmp_commands);
     qmp_init_marshal(&qmp_commands);
 
     qmp_register_command(&qmp_commands, "query-qmp-schema",
diff --git a/qga/main.c b/qga/main.c
index 62a62755bd..b949b1ccb0 100644
--- a/qga/main.c
+++ b/qga/main.c
@@ -1360,6 +1360,7 @@  int main(int argc, char **argv)
 
     config->log_level = G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL;
 
+    QTAILQ_INIT(&ga_commands);
     qga_qmp_init_marshal(&ga_commands);
 
     init_dfl_pathnames();
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index ad7b6e4e1d..28ce88e012 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -283,6 +283,7 @@  int main(int argc, char **argv)
     g_test_add_func("/0.15/dealloc_types", test_dealloc_types);
     g_test_add_func("/0.15/dealloc_partial", test_dealloc_partial);
 
+    QTAILQ_INIT(&qmp_commands);
     test_qmp_init_marshal(&qmp_commands);
     g_test_run();