static void monitor_protocol_emitter(Monitor *mon, QObject *data,

                                     QError *err)

{

    QDict *qmp;



    trace_monitor_protocol_emitter(mon);



    if (!err) {

        /* success response */

        qmp = qdict_new();

        if (data) {

            qobject_incref(data);

            qdict_put_obj(qmp, "return", data);

        } else {

            /* return an empty QDict by default */

            qdict_put(qmp, "return", qdict_new());

        }

    } else {

        /* error response */

        qmp = build_qmp_error_dict(err);

    }



    if (mon->mc->id) {

        qdict_put_obj(qmp, "id", mon->mc->id);

        mon->mc->id = NULL;

    }



    monitor_json_emitter(mon, QOBJECT(qmp));

    QDECREF(qmp);

}

static void monitor_protocol_emitter(Monitor *mon, QObject *data,

                                     QError *err)

{

    QDict *qmp;



    trace_monitor_protocol_emitter(mon);



    if (!err) {

        

        qmp = qdict_new();

        if (data) {

            qobject_incref(data);

            qdict_put_obj(qmp, "return", data);

        } else {

            

            qdict_put(qmp, "return", qdict_new());

        }

    } else {

        

        qmp = build_qmp_error_dict(err);

    }



    if (mon->mc->id) {

        qdict_put_obj(qmp, "id", mon->mc->id);

        mon->mc->id = NULL;

    }



    monitor_json_emitter(mon, QOBJECT(qmp));

    QDECREF(qmp);

}

static void FUNC_0(Monitor *VAR_0, QObject *VAR_1,

                                     QError *VAR_2)

{

    QDict *qmp;



    trace_monitor_protocol_emitter(VAR_0);



    if (!VAR_2) {

        

        qmp = qdict_new();

        if (VAR_1) {

            qobject_incref(VAR_1);

            qdict_put_obj(qmp, "return", VAR_1);

        } else {

            

            qdict_put(qmp, "return", qdict_new());

        }

    } else {

        

        qmp = build_qmp_error_dict(VAR_2);

    }



    if (VAR_0->mc->id) {

        qdict_put_obj(qmp, "id", VAR_0->mc->id);

        VAR_0->mc->id = NULL;

    }



    monitor_json_emitter(VAR_0, QOBJECT(qmp));

    QDECREF(qmp);

}

static void FUNC_0(Monitor *VAR_0, QObject *VAR_1,
QError *VAR_2)
{ QDict *qmp; trace_monitor_protocol_emitter(VAR_0); if (!VAR_2) { qmp = qdict_new(); if (VAR_1) { qobject_incref(VAR_1); qdict_put_obj(qmp, "return", VAR_1); } else { qdict_put(qmp, "return", qdict_new()); } } else { qmp = build_qmp_error_dict(VAR_2); } if (VAR_0->mc->id) { qdict_put_obj(qmp, "id", VAR_0->mc->id); VAR_0->mc->id = NULL; } monitor_json_emitter(VAR_0, QOBJECT(qmp)); QDECREF(qmp); }