qemu-devel
[Top][All Lists]
Advanced

[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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]