[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] rng: switch request queue to QSIMPLEQ
From: |
Amit Shah |
Subject: |
Re: [Qemu-devel] [PATCH] rng: switch request queue to QSIMPLEQ |
Date: |
Fri, 4 Mar 2016 11:57:23 +0530 |
On (Thu) 03 Mar 2016 [14:16:11], Ladi Prosek wrote:
> QSIMPLEQ supports appending to tail in O(1) and is intrusive so
> it doesn't require extra memory allocations for the bookkeeping
> data.
>
> Suggested-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Ladi Prosek <address@hidden>
> @@ -83,24 +83,27 @@ static void rng_backend_free_request(RngRequest *req)
>
> static void rng_backend_free_requests(RngBackend *s)
> {
> - GSList *i;
> + RngRequest *req, *next;
>
> - for (i = s->requests; i; i = i->next) {
> - rng_backend_free_request(i->data);
> + QSIMPLEQ_FOREACH_SAFE(req, &s->requests, next, next) {
> + rng_backend_free_request(req);
> }
>
> - g_slist_free(s->requests);
> - s->requests = NULL;
> + QSIMPLEQ_INIT(&s->requests);
> }
This init here isn't necessary, the accessors for the queue will take
care of this.
Amit
Re: [Qemu-devel] [PATCH] rng: switch request queue to QSIMPLEQ, Amit Shah, 2016/03/04