adapter: simplify gst_adapter_take_list()

Use a stack-allocated GQueue to assemble our GList.
This commit is contained in:
Tim-Philipp Müller 2011-11-01 14:17:21 +00:00
parent bb2020b1e7
commit cf69ce1df6

View file

@ -737,7 +737,7 @@ done:
GList *
gst_adapter_take_list (GstAdapter * adapter, guint nbytes)
{
GList *result = NULL, *tail = NULL;
GQueue queue = G_QUEUE_INIT;
GstBuffer *cur;
guint hsize, skip;
@ -753,15 +753,11 @@ gst_adapter_take_list (GstAdapter * adapter, guint nbytes)
cur = gst_adapter_take_buffer (adapter, hsize);
if (result == NULL) {
result = tail = g_list_append (result, cur);
} else {
tail = g_list_append (tail, cur);
tail = g_list_next (tail);
}
g_queue_push_tail (&queue, cur);
nbytes -= hsize;
}
return result;
return queue.head;
}
/**