[Patch 04/12] CLD: remove g_list_foreach

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

 



In practice this is not a bug, because g_list_foreach is implemented
cleverly, and so the old code works. But it looks more direct with one
less function, and we do not depend on g_list_foreach doing the
right thing, since it's not in the documentation anywhere.

Signed-off-by: Pete Zaitcev <zaitcev@xxxxxxxxxx>

---
 lib/cldc.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

commit 1c32872b92911a1bbf48f8a9033569eb5ae33095
Author: Master <zaitcev@xxxxxxxxxxxxxxxxxx>
Date:   Sat Apr 17 19:15:54 2010 -0600

    Eshew g_list_foreach when changing the list.

diff --git a/lib/cldc.c b/lib/cldc.c
index 6ab2fe4..8a238e4 100644
--- a/lib/cldc.c
+++ b/lib/cldc.c
@@ -2239,14 +2239,12 @@ void ncld_close(struct ncld_fh *fh)
 	free(fh);
 }
 
-static void ncld_func_close(gpointer data, gpointer priv)
-{
-	ncld_close(data);
-}
-
 void ncld_sess_close(struct ncld_sess *nsess)
 {
-	g_list_foreach(nsess->handles, ncld_func_close, NULL);
+	gpointer p;
+
+	while ((p = g_list_nth_data(nsess->handles, 0)))
+		ncld_close(p);
 	g_list_free(nsess->handles);
 
 	cldc_kill_sess(nsess->udp->sess);
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Fedora Clound]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux