From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37439) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3XBh-0005AG-Rw for qemu-devel@nongnu.org; Fri, 12 Jun 2015 18:12:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3XBg-0000F6-SA for qemu-devel@nongnu.org; Fri, 12 Jun 2015 18:12:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3XBg-0000Ey-My for qemu-devel@nongnu.org; Fri, 12 Jun 2015 18:12:32 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id BE3552F146A for ; Fri, 12 Jun 2015 22:12:31 +0000 (UTC) From: Bandan Das References: <1433371090-11781-1-git-send-email-bsd@redhat.com> <1433371090-11781-3-git-send-email-bsd@redhat.com> <874mmd797p.fsf@blackfin.pond.sub.org> Date: Fri, 12 Jun 2015 18:12:30 -0400 In-Reply-To: <874mmd797p.fsf@blackfin.pond.sub.org> (Markus Armbruster's message of "Fri, 12 Jun 2015 08:05:14 +0200") Message-ID: 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: Markus Armbruster Cc: qemu-devel@nongnu.org Markus Armbruster writes: > 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: Looks good, Markus. Thank you for taking care of the conflict. Bandan > 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); > } >