qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 2/7] monitor: rename *_pop_one to *_pop_any


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v4 2/7] monitor: rename *_pop_one to *_pop_any
Date: Tue, 19 Jun 2018 15:44:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Peter Xu <address@hidden> 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 <address@hidden>
> Signed-off-by: Peter Xu <address@hidden>
> ---
>  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 <address@hidden>

[...]



reply via email to

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