qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 2/6] monitor: flush qmp responses when CLOSED


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v3 2/6] monitor: flush qmp responses when CLOSED
Date: Tue, 19 Jun 2018 15:40:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Peter Xu <address@hidden> writes:

> On Fri, Jun 15, 2018 at 10:11:34AM +0200, Markus Armbruster wrote:
[...]
>> diff --git a/monitor.c b/monitor.c
>> index e59d4f09ac..af28977549 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -512,7 +512,7 @@ struct QMPResponse {
>>  };
>>  typedef struct QMPResponse QMPResponse;
>>  
>> -static QObject *monitor_qmp_response_pop_one(Monitor *mon)
>> +static QObject *monitor_qmp_requests_pop(Monitor *mon)
>
> I guess it's a typo; I'll keep the "response" word.

You're right.

>>  {
>>      QObject *data;
>>  
>> @@ -527,41 +527,39 @@ static void monitor_qmp_response_flush(Monitor *mon)
>>  {
>>      QObject *data;
>>  
>> -    while ((data = monitor_qmp_response_pop_one(mon))) {
>> +    while ((data = monitor_qmp_requests_pop(mon))) {
>
> Same here.
>
>>          monitor_json_emitter_raw(mon, data);
>>          qobject_unref(data);
>>      }
>>  }
>>  
>>  /*
>> - * Return one QMPResponse.  The response is only valid if
>> - * response.data is not NULL.
>> + * Pop a QMPResponse from any monitor's response queue into @response.
>> + * Return NULL when all queues are empty, else @response.
>
> I'll change the return value to a boolean directly if it's okay, since
> after all we'll pass the QMPResponse in now.

I routinely return the buffer argument in cases like this.  It's quite
traditional, e.g. fgets(), memcpy(), strcpy() do it, too.  Occasionally
permits more concise code, but not here.

[...]



reply via email to

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