- use g_list_foreach where apropriate

Original commit message from CVS:
- use g_list_foreach where apropriate
This commit is contained in:
Wim Taymans 2003-04-14 18:38:11 +00:00
parent 838ffca4fa
commit 4c33218ba3
2 changed files with 7 additions and 60 deletions

View file

@ -246,18 +246,11 @@ gst_bin_auto_clock (GstBin *bin)
static void
gst_bin_set_index (GstElement *element, GstIndex *index)
{
GList *children;
GstBin *bin = GST_BIN (element);
g_return_if_fail (GST_IS_BIN (bin));
children = bin->children;
while (children) {
GstElement *child = GST_ELEMENT (children->data);
children = g_list_next (children);
gst_element_set_index (child, index);
}
g_list_foreach (bin->children, (GFunc) gst_element_set_index, index);
}
#endif
@ -269,8 +262,6 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
/* if it's actually a Bin */
if (GST_IS_BIN (element)) {
GList *children;
if (GST_FLAG_IS_SET (element, GST_BIN_FLAG_MANAGER)) {
GST_INFO_ELEMENT (GST_CAT_PARENTAGE, element, "child is already a manager, not resetting");
if (GST_ELEMENT_SCHED (element))
@ -282,13 +273,7 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
gst_scheduler_add_element (sched, element);
/* set the children's schedule */
children = GST_BIN (element)->children;
while (children) {
GstElement *child = GST_ELEMENT (children->data);
children = g_list_next (children);
gst_bin_set_element_sched (child, sched);
}
g_list_foreach (GST_BIN (element)->children, (GFunc) gst_bin_set_element_sched, sched);
}
/* otherwise, if it's just a regular old element */
else {
@ -328,9 +313,6 @@ gst_bin_set_element_sched (GstElement *element, GstScheduler *sched)
static void
gst_bin_unset_element_sched (GstElement *element, GstScheduler *sched)
{
GList *children;
GstElement *child;
if (GST_ELEMENT_SCHED (element) == NULL) {
GST_INFO (GST_CAT_SCHEDULING, "element \"%s\" has no scheduler",
GST_ELEMENT_NAME (element));
@ -352,13 +334,7 @@ gst_bin_unset_element_sched (GstElement *element, GstScheduler *sched)
return;
}
/* for each child, remove them from their schedule */
children = GST_BIN (element)->children;
while (children) {
child = GST_ELEMENT (children->data);
children = g_list_next (children);
gst_bin_unset_element_sched (child, sched);
}
g_list_foreach (GST_BIN (element)->children, (GFunc) gst_bin_unset_element_sched, sched);
gst_scheduler_remove_element (GST_ELEMENT_SCHED (element), element);
}

View file

@ -183,14 +183,7 @@ gst_props_debug_entry (GstPropsEntry *entry)
break;
case GST_PROPS_LIST_TYPE:
GST_DEBUG (GST_CAT_PROPERTIES, "%p: [list]", entry);
{
GList *entries = entry->data.list_data.entries;
while (entries) {
gst_props_debug_entry ((GstPropsEntry *)entries->data);
entries = g_list_next (entries);
}
}
g_list_foreach (entry->data.list_data.entries, (GFunc) gst_props_debug_entry, NULL);
break;
default:
g_warning ("unknown property type %d at %p", entry->propstype, entry);
@ -328,16 +321,9 @@ gst_props_entry_clean (GstPropsEntry *entry)
g_free (entry->data.string_data.string);
break;
case GST_PROPS_LIST_TYPE:
{
GList *entries = entry->data.list_data.entries;
while (entries) {
gst_props_entry_destroy ((GstPropsEntry *)entries->data);
entries = g_list_next (entries);
}
g_list_foreach (entry->data.list_data.entries, (GFunc) gst_props_entry_destroy, NULL);
g_list_free (entry->data.list_data.entries);
break;
}
default:
break;
}
@ -520,17 +506,9 @@ gst_props_new (const gchar *firstname, ...)
void
gst_props_debug (GstProps *props)
{
GList *propslist = props->properties;
GST_DEBUG (GST_CAT_PROPERTIES, "props %p, refcount %d, flags %d", props, props->refcount, props->flags);
while (propslist) {
GstPropsEntry *entry = (GstPropsEntry *)propslist->data;
gst_props_debug_entry (entry);
propslist = g_list_next (propslist);
}
g_list_foreach (props->properties, (GFunc) gst_props_debug_entry, NULL);
}
/**
@ -926,17 +904,10 @@ gst_props_sink (GstProps *props)
void
gst_props_destroy (GstProps *props)
{
GList *entries;
if (props == NULL)
return;
entries = props->properties;
while (entries) {
gst_props_entry_destroy ((GstPropsEntry *)entries->data);
entries = g_list_next (entries);
}
g_list_foreach (props->properties, (GFunc) gst_props_entry_destroy, NULL);
g_list_free (props->properties);
gst_mem_chunk_free (_gst_props_chunk, props);