16.12.2020, 08:58, "Jason Wang" <jasow...@redhat.com>:
> ----- Original Message -----
>>  Jason Wang <jasow...@redhat.com> writes:
>>
>>  [...]
>>  > One more stupid question, instead of generating the string via hard
>>  > codes, is there any method (dict?) to iterate all the key/values
>>  > automatically?
>>
>>  QAPI visitors.
>>
>>  The lazy way: use the QObject output visitor to convert the QAPI type
>>  (here: NetdevInfo) to QObject, then qobject_to_json() to convert to
>>  JSON text.
>>
>>  If you don't want JSON, replace qobject_to_json(). Perhaps you can
>>  create something that's generally useful for HMP, not just "info
>>  network". I'd pick keyval_parse() syntax.
>>
>>  The detour through QObject creates and destroys a rather fat temporary
>>  data structure. Tolerable when the amount of data is small. An output
>>  visitor that directly creates the string is more efficient. Takes a bit
>>  more code, though. I intend to post one for JSON, to reduce QMP's
>>  malloc gluttony.
>
> Thanks a lot for the answer.
>
> Alexey, let's try what Markus suggested here.

Thanks for information.
I will do so and send a new version of the patchset.

-- 
Alexey Kirillov
Yandex.Cloud

Reply via email to