[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 07/28] qmp: Clean up how we enforce capabilit
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v4 07/28] qmp: Clean up how we enforce capability negotiation |
Date: |
Fri, 3 Mar 2017 13:57:45 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 03/03/2017 01:45 PM, Markus Armbruster wrote:
>>> - rsp = qmp_dispatch(&qmp_commands, req);
>>> + qdict = qdict_get_qdict(qobject_to_qdict(rsp), "error");
>>> + if (qdict) {
>>> + if (mon->qmp.commands == &qmp_cap_negotiation_commands
>>> + && !g_strcmp0(qdict_get_try_str(qdict, "class"),
>>> + QapiErrorClass_lookup[ERROR_CLASS_COMMAND_NOT_FOUND]))
>>> {
>>
>> Could join these two 'if' into one, for less {}, but that's cosmetic.
>
> Or maybe get reshuffle so that qdict_get_qdict() is called only when
> needed:
>
> if (mon->qmp.commands == &qmp_cap_negotiation_commands) {
> qdict = qdict_get_qdict(qobject_to_qdict(rsp), "error");
> if (qdict
> && !g_strcmp0(qdict_get_try_str(qdict, "class"),
> QapiErrorClass_lookup[ERROR_CLASS_COMMAND_NOT_FOUND])) {
> /* Provide a more useful error message */
Yes, that's even nicer (it's probably in the noise, but
micro-optimizations are fun!)
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v4 28/28] qapi: Improve qobject visitor documentation, (continued)
- [Qemu-devel] [PATCH v4 28/28] qapi: Improve qobject visitor documentation, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 21/28] test-string-input-visitor: Tear down existing test automatically, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 19/28] qapi: Drop unused non-strict qobject input visitor, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 02/28] libqtest: Work around a "QMP wants a newline" bug, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 22/28] test-string-input-visitor: Improve list coverage, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 14/28] qapi: Improve qobject input visitor error reporting, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 20/28] tests-qobject-input-strict: Merge into test-qobject-input-visitor, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 07/28] qmp: Clean up how we enforce capability negotiation, Markus Armbruster, 2017/03/03
- [Qemu-devel] [PATCH v4 16/28] qapi: Make string input and opts visitor require non-null input, Markus Armbruster, 2017/03/03
[Qemu-devel] [PATCH v4 05/28] qapi: Support multiple command registries per program, Markus Armbruster, 2017/03/03
Re: [Qemu-devel] [PATCH v4 00/28] qapi: QMP dispatch and input visitor work, no-reply, 2017/03/03