mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 07:26:29 +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 *
|
GList *
|
||||||
gst_adapter_take_list (GstAdapter * adapter, guint nbytes)
|
gst_adapter_take_list (GstAdapter * adapter, guint nbytes)
|
||||||
{
|
{
|
||||||
GList *result = NULL, *tail = NULL;
|
GQueue queue = G_QUEUE_INIT;
|
||||||
GstBuffer *cur;
|
GstBuffer *cur;
|
||||||
guint hsize, skip;
|
guint hsize, skip;
|
||||||
|
|
||||||
|
@ -753,15 +753,11 @@ gst_adapter_take_list (GstAdapter * adapter, guint nbytes)
|
||||||
|
|
||||||
cur = gst_adapter_take_buffer (adapter, hsize);
|
cur = gst_adapter_take_buffer (adapter, hsize);
|
||||||
|
|
||||||
if (result == NULL) {
|
g_queue_push_tail (&queue, cur);
|
||||||
result = tail = g_list_append (result, cur);
|
|
||||||
} else {
|
|
||||||
tail = g_list_append (tail, cur);
|
|
||||||
tail = g_list_next (tail);
|
|
||||||
}
|
|
||||||
nbytes -= hsize;
|
nbytes -= hsize;
|
||||||
}
|
}
|
||||||
return result;
|
return queue.head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue