Peter Xu <pet...@redhat.com> 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. [...]