Revision 13917bee

b/monitor.c
77 77
    union {
78 78
        void (*info)(Monitor *mon);
79 79
        void (*cmd)(Monitor *mon, const QDict *qdict);
80
        void (*cmd_new)(Monitor *mon, const QDict *params, QObject **ret_data);
80 81
    } mhandler;
81 82
} mon_cmd_t;
82 83

  
......
214 215
    return 0;
215 216
}
216 217

  
218
static inline int monitor_handler_ported(const mon_cmd_t *cmd)
219
{
220
    return cmd->user_print != NULL;
221
}
222

  
217 223
static int compare_cmd(const char *name, const char *list)
218 224
{
219 225
    const char *p, *pstart;
......
3014 3020
    qdict = qdict_new();
3015 3021

  
3016 3022
    cmd = monitor_parse_command(mon, cmdline, qdict);
3017
    if (cmd) {
3018
        qemu_errors_to_mon(mon);
3023
    if (!cmd)
3024
        goto out;
3025

  
3026
    qemu_errors_to_mon(mon);
3027

  
3028
    if (monitor_handler_ported(cmd)) {
3029
        QObject *data = NULL;
3030

  
3031
        cmd->mhandler.cmd_new(mon, qdict, &data);
3032
        if (data)
3033
            cmd->user_print(mon, data);
3034

  
3035
        qobject_decref(data);
3036
    } else {
3019 3037
        cmd->mhandler.cmd(mon, qdict);
3020
        qemu_errors_to_previous();
3021 3038
    }
3022 3039

  
3040
   qemu_errors_to_previous();
3041

  
3042
out:
3023 3043
    QDECREF(qdict);
3024 3044
}
3025 3045

  

Also available in: Unified diff