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