From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [Patch 04/12] CLD: remove g_list_foreach
Date: Sat, 17 Apr 2010 22:40:03 -0600 [thread overview]
Message-ID: <20100417224003.511a3ed5@redhat.com> (raw)
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@redhat.com>
---
lib/cldc.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
commit 1c32872b92911a1bbf48f8a9033569eb5ae33095
Author: Master <zaitcev@lembas.zaitcev.lan>
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);
reply other threads:[~2010-04-18 4:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100417224003.511a3ed5@redhat.com \
--to=zaitcev@redhat.com \
--cc=hail-devel@vger.kernel.org \
--cc=jeff@garzik.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).