[Pkg-telepathy-commits] [libnice] 245/265: discovery: Use g_slist_free_full for discovery list

Simon McVittie smcv at debian.org
Wed May 14 12:05:13 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository libnice.

commit 9057acc5300a6038c73cee25470a4c0950f3d31c
Author: Olivier Crête <olivier.crete at collabora.com>
Date:   Tue Apr 22 17:03:03 2014 -0400

    discovery: Use g_slist_free_full for discovery list
---
 agent/discovery.c | 14 +++++---------
 agent/discovery.h |  1 -
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/agent/discovery.c b/agent/discovery.c
index 7511d3d..2fa3ea7 100644
--- a/agent/discovery.c
+++ b/agent/discovery.c
@@ -70,13 +70,10 @@ static inline int priv_timer_expired (GTimeVal *timer, GTimeVal *now)
 
 /*
  * Frees the CandidateDiscovery structure pointed to
- * by 'user data'. Compatible with g_slist_foreach().
+ * by 'user data'. Compatible with g_slist_free_full().
  */
-void discovery_free_item (gpointer data, gpointer user_data)
+static void discovery_free_item (CandidateDiscovery *cand)
 {
-  CandidateDiscovery *cand = data;
-  g_assert (user_data == NULL);
-
   g_slice_free (CandidateDiscovery, cand);
 }
 
@@ -85,9 +82,8 @@ void discovery_free_item (gpointer data, gpointer user_data)
  */
 void discovery_free (NiceAgent *agent)
 {
-
-  g_slist_foreach (agent->discovery_list, discovery_free_item, NULL);
-  g_slist_free (agent->discovery_list);
+  g_slist_free_full (agent->discovery_list,
+      (GDestroyNotify) discovery_free_item);
   agent->discovery_list = NULL;
   agent->discovery_unsched_items = 0;
 
@@ -114,7 +110,7 @@ void discovery_prune_stream (NiceAgent *agent, guint stream_id)
 
     if (cand->stream->id == stream_id) {
       agent->discovery_list = g_slist_remove (agent->discovery_list, cand);
-      discovery_free_item (cand, NULL);
+      discovery_free_item (cand);
     }
     i = next;
   }
diff --git a/agent/discovery.h b/agent/discovery.h
index 5a12a8c..6d848a5 100644
--- a/agent/discovery.h
+++ b/agent/discovery.h
@@ -88,7 +88,6 @@ void refresh_prune_stream (NiceAgent *agent, guint stream_id);
 void refresh_cancel (CandidateRefresh *refresh);
 
 
-void discovery_free_item (gpointer data, gpointer user_data);
 void discovery_free (NiceAgent *agent);
 void discovery_prune_stream (NiceAgent *agent, guint stream_id);
 void discovery_schedule (NiceAgent *agent);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git



More information about the Pkg-telepathy-commits mailing list