Received: from eggs.gnu.org ([2001:4830:134:3::10]:52102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3I5j-0007a6-44 for qemu-devel@nongnu.org; Fri, 12 Jun 2015 02:05:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3I5e-0002Wy-4q for qemu-devel@nongnu.org; Fri, 12 Jun 2015 02:05:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52441) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3I5d-0002Wq-VJ for qemu-devel@nongnu.org; Fri, 12 Jun 2015 02:05:18 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 35A642D155A for ; Fri, 12 Jun 2015 06:05:17 +0000 (UTC) From: Markus Armbruster References: <1433371090-11781-1-git-send-email-bsd@redhat.com> <1433371090-11781-3-git-send-email-bsd@redhat.com> Date: Fri, 12 Jun 2015 08:05:14 +0200 In-Reply-To: <1433371090-11781-3-git-send-email-bsd@redhat.com> (Bandan Das's message of "Wed, 3 Jun 2015 18:38:08 -0400") Message-ID: <874mmd797p.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5 2/4] monitor: cleanup parsing of cmd name and cmd arguments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bandan Das Cc: qemu-devel@nongnu.org Bandan Das writes: > There's too much going on in monitor_parse_command(). > Split up the arguments parsing bits into a separate function > monitor_parse_arguments(). Let the original function check for > command validity and sub-commands if any and return data (*cmd) > that the newly introduced function can process and return a > QDict. Also, pass a pointer to the cmdline to track current > parser location. > > Suggested-by: Markus Armbruster > Signed-off-by: Bandan Das Doesn't apply cleanly anymore. Please double-check my conflict resolution carefully: diff --git a/monitor.c b/monitor.c index bcb88cd..0b0a8df 100644 --- a/monitor.c +++ b/monitor.c [...] @@ -4156,13 +4168,17 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline) QDict *qdict; const mon_cmd_t *cmd; - qdict = qdict_new(); + cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table); + if (!cmd) { + return; + } - cmd = monitor_parse_command(mon, cmdline, 0, mon->cmd_table, qdict); - if (cmd) { - cmd->mhandler.cmd(mon, qdict); + qdict = monitor_parse_arguments(mon, &cmdline, cmd); + if (!qdict) { + return; } + cmd->mhandler.cmd(mon, qdict); QDECREF(qdict); }