From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvuM1-0006r3-FR for qemu-devel@nongnu.org; Fri, 22 May 2015 17:19:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvuLy-0007RH-EU for qemu-devel@nongnu.org; Fri, 22 May 2015 17:19:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvuLy-0007R8-6c for qemu-devel@nongnu.org; Fri, 22 May 2015 17:19:38 -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 (8.14.4/8.14.4) with ESMTP id t4MLJbpk030880 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 22 May 2015 17:19:37 -0400 Message-ID: <555F9D68.8010102@redhat.com> Date: Fri, 22 May 2015 15:19:36 -0600 From: Eric Blake MIME-Version: 1.0 References: <1432294585-5984-1-git-send-email-armbru@redhat.com> <1432294585-5984-3-git-send-email-armbru@redhat.com> In-Reply-To: <1432294585-5984-3-git-send-email-armbru@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5vhVQaX54G5LpvQs84CK24KBeI6inlX7n" Subject: Re: [Qemu-devel] [PATCH 02/20] monitor: Clean up after previous commit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5vhVQaX54G5LpvQs84CK24KBeI6inlX7n Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/22/2015 05:36 AM, Markus Armbruster wrote: > Signed-off-by: Markus Armbruster > --- Commit message is sparse; I would have mentioned [1] and [2]. > monitor.c | 40 +++++++++++----------------------------- > 1 file changed, 11 insertions(+), 29 deletions(-) >=20 > =20 > -static void handler_audit(Monitor *mon, const mon_cmd_t *cmd, int ret)= > -{ > - if (ret && !monitor_has_error(mon)) { > - /* > - * If it returns failure, it must have passed on error. > - * > - * Action: Report an internal error to the client if in QMP. > - */ > - qerror_report(QERR_UNDEFINED_ERROR); > - } > -} [2] - handler_audit() goes away now that it has no caller > - > static void handle_user_command(Monitor *mon, const char *cmdline) > { > QDict *qdict; > @@ -5015,28 +5003,17 @@ static QDict *qmp_check_input_obj(QObject *inpu= t_obj) > return input_dict; > } > =20 > -static void qmp_call_cmd(Monitor *mon, const mon_cmd_t *cmd, > - const QDict *params) > -{ > - int ret; > - QObject *data =3D NULL; > - > - ret =3D cmd->mhandler.cmd_new(mon, params, &data); > - handler_audit(mon, cmd, ret); > - monitor_protocol_emitter(mon, data); > - qobject_decref(data); > -} [1] - qmp_call_cmd() is inlined and simplified... > - > static void handle_qmp_command(JSONMessageParser *parser, QList *token= s) > { > int err; > - QObject *obj; > + QObject *obj, *data; > QDict *input, *args; > const mon_cmd_t *cmd; > const char *cmd_name; > Monitor *mon =3D cur_mon; > =20 > args =3D input =3D NULL; > + data =3D NULL; > =20 > obj =3D json_parser_parse(tokens, NULL); > if (!obj) { > @@ -5079,12 +5056,17 @@ static void handle_qmp_command(JSONMessageParse= r *parser, QList *tokens) > goto err_out; > } > =20 > - qmp_call_cmd(mon, cmd, args); > - goto out; > + if (cmd->mhandler.cmd_new(mon, args, &data)) { > + /* Command failed... */ > + if (!monitor_has_error(mon)) { > + /* ... without setting an error, so make one up */ > + qerror_report(QERR_UNDEFINED_ERROR); > + } > + } =2E..into its lone caller. > =20 > err_out: > - monitor_protocol_emitter(mon, NULL); > -out: > + monitor_protocol_emitter(mon, data); > + qobject_decref(data); > QDECREF(input); > QDECREF(args); > } >=20 But the code cleanup itself looks sane, so with the improved commit messa= ge: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --5vhVQaX54G5LpvQs84CK24KBeI6inlX7n Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVX51oAAoJEKeha0olJ0NqlFQH/RXC7AqVy15DLMGxwdUDj2pY NSAvN0Qkq6Xa4KG7h6gzebFFBlzIwrGoMfJHfdAQQAl5V455svMLEPEDaS7p6wwh BGKvRBTn2E22PbfsQcZ/IYwE3TzaD8HCwwf1RkoUmVgWFAOeq2gLbHRetcetNmPk zc/W2ubO5YUJisWyaOmZgxjOVOblVCPNXv9k/RpbTSm81ne7XKAhDFlORA2rc5vx UMwmHkWNJcERo6/tmI0Y8EjdRmCGslfDSU3IBk7+7xd0wuyfRb8k/4NtfF1UFtvo o/Qqutj2rgs0ICQbmVEe93kIFsuJvvmc6WbqdqTWQg7ddlFdmZa298LGDiusDYw= =XlMy -----END PGP SIGNATURE----- --5vhVQaX54G5LpvQs84CK24KBeI6inlX7n--