From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MoH2Q-0008Cf-84 for qemu-devel@nongnu.org; Thu, 17 Sep 2009 09:28:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MoH2L-000835-Ga for qemu-devel@nongnu.org; Thu, 17 Sep 2009 09:28:41 -0400 Received: from [199.232.76.173] (port=47687 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MoH2L-00082s-4R for qemu-devel@nongnu.org; Thu, 17 Sep 2009 09:28:37 -0400 Received: from mail-qy0-f189.google.com ([209.85.221.189]:38159) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MoH2L-0004Xu-6k for qemu-devel@nongnu.org; Thu, 17 Sep 2009 09:28:37 -0400 Received: by qyk27 with SMTP id 27so44868qyk.13 for ; Thu, 17 Sep 2009 06:28:36 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4AB23980.6030007@gnu.org> Date: Thu, 17 Sep 2009 15:28:32 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1253136760-3614-1-git-send-email-lcapitulino@redhat.com> <1253136760-3614-3-git-send-email-lcapitulino@redhat.com> <4AB1D99D.5080007@gnu.org> <20090917101831.69fc8b1f@doriath> In-Reply-To: <20090917101831.69fc8b1f@doriath> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 2/7] monitor: Handle new and old style handlers List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: qemu-devel > 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