mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
adapter: simplify gst_adapter_take_list()
Use a stack-allocated GQueue to assemble our GList.
This commit is contained in:
parent
bb2020b1e7
commit
cf69ce1df6
1 changed files with 4 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue