qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] rng-egd: don't use gslist_free_full
@ 2012-11-16 19:10 Anthony Liguori
  2012-11-19  9:10 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liguori @ 2012-11-16 19:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

This function was only introduced in glib 2.28.0.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 backends/rng-egd.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/backends/rng-egd.c b/backends/rng-egd.c
index ec58358..ad84737 100644
--- a/backends/rng-egd.c
+++ b/backends/rng-egd.c
@@ -110,6 +110,18 @@ static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)
     }
 }
 
+static void rng_egd_free_requests(RngEgd *s)
+{
+    GSList *i;
+
+    for (i = s->requests; i; i = i->next) {
+        rng_egd_free_request(i->data);
+    }
+
+    g_slist_free(s->requests);
+    s->requests = NULL;
+}
+
 static void rng_egd_cancel_requests(RngBackend *b)
 {
     RngEgd *s = RNG_EGD(b);
@@ -118,9 +130,7 @@ static void rng_egd_cancel_requests(RngBackend *b)
      * queue waiting to be read, this is okay, because there will always be
      * more data than we requested originally
      */
-    g_slist_free_full(s->requests,
-                      (GDestroyNotify)rng_egd_free_request);
-    s->requests = NULL;
+    rng_egd_free_requests(s);
 }
 
 static void rng_egd_opened(RngBackend *b, Error **errp)
@@ -185,8 +195,7 @@ static void rng_egd_finalize(Object *obj)
 
     g_free(s->chr_name);
 
-    g_slist_free_full(s->requests, (GDestroyNotify)rng_egd_free_request);
-    s->requests = NULL;
+    rng_egd_free_requests(s);
 }
 
 static void rng_egd_class_init(ObjectClass *klass, void *data)
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-19 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 19:10 [Qemu-devel] [PATCH] rng-egd: don't use gslist_free_full Anthony Liguori
2012-11-19  9:10 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).