Commit 4441eea8 authored by Philip Withnall's avatar Philip Withnall

agent: Use g_slist_free_full() to reduce code

This introduces no functional changes.
parent 67392282
......@@ -225,20 +225,9 @@ component_clear_selected_pair (Component *component)
void
component_close (Component *cmp)
{
GSList *i;
IOCallbackData *data;
GOutputVector *vec;
for (i = cmp->local_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data;
nice_candidate_free (candidate);
}
for (i = cmp->remote_candidates; i; i = i->next) {
NiceCandidate *candidate = i->data;
nice_candidate_free (candidate);
}
if (cmp->restart_candidate)
nice_candidate_free (cmp->restart_candidate),
cmp->restart_candidate = NULL;
......@@ -247,9 +236,11 @@ component_close (Component *cmp)
nice_candidate_free (cmp->turn_candidate),
cmp->turn_candidate = NULL;
g_slist_free (cmp->local_candidates);
g_slist_free_full (cmp->local_candidates,
(GDestroyNotify) nice_candidate_free);
cmp->local_candidates = NULL;
g_slist_free (cmp->remote_candidates);
g_slist_free_full (cmp->remote_candidates,
(GDestroyNotify) nice_candidate_free);
cmp->remote_candidates = NULL;
component_free_socket_sources (cmp);
g_slist_free_full (cmp->incoming_checks,
......
......@@ -80,16 +80,8 @@ stream_close (Stream *stream)
void
stream_free (Stream *stream)
{
GSList *i;
if (stream->name)
g_free (stream->name);
for (i = stream->components; i; i = i->next) {
Component *component = i->data;
component_free (component);
i->data = NULL;
}
g_slist_free (stream->components);
g_free (stream->name);
g_slist_free_full (stream->components, (GDestroyNotify) component_free);
g_slice_free (Stream, stream);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment