Peter Xu <pet...@redhat.com> writes:

> The old names are confusing since both of the old functions are poping
> an item from multiple queues rather than a single queue.  In that
> sense, *_pop_any() suites better than *_pop_one().
>
> Since at it, touch up the function monitor_qmp_response_pop_any() a bit
> to let the callers pass in a QMPResponse struct instead of returning a
> struct.  Change the return value to boolean to mark whether we have
> poped a valid response instead.
>
> Suggested-by: Markus Armbruster <arm...@redhat.com>
> Signed-off-by: Peter Xu <pet...@redhat.com>
> ---
>  monitor.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index 6d0cec552e..d4a463f707 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -513,10 +513,10 @@ struct QMPResponse {
>  typedef struct QMPResponse QMPResponse;
>  
>  /*
> - * 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 false if all the queues are empty; else true.
>   */
> -static QMPResponse monitor_qmp_response_pop_one(void)
> +static bool monitor_qmp_response_pop_any(QMPResponse *response)
>  {
>      Monitor *mon;
>      QObject *data = NULL;

I'd return @response.  Matter of taste.

With Eric's spelling fixes:
Reviewed-by: Markus Armbruster <arm...@redhat.com>

[...]

Reply via email to