[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 2/7] monitor: Handle new and old style handlers
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] Re: [PATCH 2/7] monitor: Handle new and old style handlers |
Date: |
Thu, 17 Sep 2009 15:28:32 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3 |
The problem is that the monitor_handler_ported() branch can
have additional code in the future (eg. protocol emission code),
so different branches makes things easier to understand.
Well, you don't know... It may end up in different functions, like
void print_cmd_result_user (Monitor *mon, MonitorCmd *cmd, int result,
QObject *data)
{
if (result)
...
else if (cmd->user_print)
cmd->user_print (mon, data);
}
void print_cmd_result_json (Monitor *mon, MonitorCmd *cmd, int result,
QObject *data)
{
... make qdict with result and data ...
qdict_print_json (mon->something, output_dict);
qobject_decref (output_dict);
}
or it may end up not being a branch (but an indirect function call) for
example:
result = handler_new (mon, qdict, &data);
mon->print_cmd_result (mon, cmd, result, data);
if (data)
qobject_decref (data);
I'd stay with the simplest thing for now. I'm not going to argue,
especially if I'm overridden by other reviewers, of course.
Paolo
Paolo
[Qemu-devel] [PATCH 3/7] monitor: do_info(): handle new and old info handlers, Luiz Capitulino, 2009/09/16
[Qemu-devel] [PATCH 4/7] monitor: Convert do_quit() do QObject, Luiz Capitulino, 2009/09/16
[Qemu-devel] [PATCH 5/7] monitor: Convert do_stop() to QObject, Luiz Capitulino, 2009/09/16
[Qemu-devel] [PATCH 6/7] monitor: Convert do_system_reset() to QObject, Luiz Capitulino, 2009/09/16
[Qemu-devel] [PATCH 7/7] monitor: Convert do_system_powerdown() to QObject, Luiz Capitulino, 2009/09/16