diff mbox

[04/12] monitor: remove usage of generated marshal functions

Message ID 20160623000809.4522-5-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau June 23, 2016, 12:08 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

Once the middle mode is removed, the generated marshal functions will no
longer be exported.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 monitor.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Eric Blake June 24, 2016, 4:23 a.m. UTC | #1
On 06/22/2016 06:08 PM, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> Once the middle mode is removed, the generated marshal functions will no
> longer be exported.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  monitor.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index fc691b9..585bc1f 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3609,21 +3609,21 @@ static int monitor_can_read(void *opaque)
>      return (mon->suspend_cnt == 0) ? 1 : 0;
>  }
>  
> -static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
> +static bool invalid_qmp_mode(const Monitor *mon, const gchar *cmd,

Why 'gchar'?  What's wrong with 'char'?  (Some of glib's typedefs make
sense, but gchar is not one of them)

> @@ -3914,7 +3914,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
>                    "The command %s has not been found", cmd_name);
>          goto err_out;
>      }
> -    if (invalid_qmp_mode(mon, cmd, &local_err)) {
> +    if (invalid_qmp_mode(mon, cmd_name, &local_err)) {
>          goto err_out;

Particularly since cmd_name is const char * in the caller.
Marc-André Lureau June 24, 2016, 2:14 p.m. UTC | #2
Hi

On Fri, Jun 24, 2016 at 6:23 AM, Eric Blake <eblake@redhat.com> wrote:
>>
>> -static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
>> +static bool invalid_qmp_mode(const Monitor *mon, const gchar *cmd,
>
> Why 'gchar'?  What's wrong with 'char'?  (Some of glib's typedefs make
> sense, but gchar is not one of them)

just some old habit, fixed.

ack otherwise?
Eric Blake June 24, 2016, 2:59 p.m. UTC | #3
On 06/24/2016 08:14 AM, Marc-André Lureau wrote:
> Hi
> 
> On Fri, Jun 24, 2016 at 6:23 AM, Eric Blake <eblake@redhat.com> wrote:
>>>
>>> -static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
>>> +static bool invalid_qmp_mode(const Monitor *mon, const gchar *cmd,
>>
>> Why 'gchar'?  What's wrong with 'char'?  (Some of glib's typedefs make
>> sense, but gchar is not one of them)
> 
> just some old habit, fixed.
> 
> ack otherwise?

Yes, you can add:
Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index fc691b9..585bc1f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3609,21 +3609,21 @@  static int monitor_can_read(void *opaque)
     return (mon->suspend_cnt == 0) ? 1 : 0;
 }
 
-static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd,
+static bool invalid_qmp_mode(const Monitor *mon, const gchar *cmd,
                              Error **errp)
 {
-    bool is_cap = cmd->mhandler.cmd_new == qmp_marshal_qmp_capabilities;
+    bool is_cap = !g_strcmp0(cmd, "qmp_capabilities");
 
     if (is_cap && mon->qmp.in_command_mode) {
         error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
                   "Capabilities negotiation is already complete, command "
-                  "'%s' ignored", cmd->name);
+                  "'%s' ignored", cmd);
         return true;
     }
     if (!is_cap && !mon->qmp.in_command_mode) {
         error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
                   "Expecting capabilities negotiation with "
-                  "'qmp_capabilities' before command '%s'", cmd->name);
+                  "'qmp_capabilities' before command '%s'", cmd);
         return true;
     }
     return false;
@@ -3914,7 +3914,7 @@  static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
                   "The command %s has not been found", cmd_name);
         goto err_out;
     }
-    if (invalid_qmp_mode(mon, cmd, &local_err)) {
+    if (invalid_qmp_mode(mon, cmd_name, &local_err)) {
         goto err_out;
     }