mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 01:48:31 +00:00
u/sink: Tiny refactor for queue
This commit is contained in:
parent
703baa94fe
commit
662b72e2f6
|
@ -98,20 +98,20 @@ queue_pop(struct u_sink_queue *q)
|
|||
static bool
|
||||
queue_try_refpush(struct u_sink_queue *q, struct xrt_frame *xf)
|
||||
{
|
||||
if (!queue_is_full(q)) {
|
||||
struct u_sink_queue_elem *elem = U_TYPED_CALLOC(struct u_sink_queue_elem);
|
||||
xrt_frame_reference(&elem->frame, xf);
|
||||
elem->next = NULL;
|
||||
if (q->back == NULL) { // First frame
|
||||
q->front = elem;
|
||||
} else { // Next frame
|
||||
q->back->next = elem;
|
||||
}
|
||||
q->back = elem;
|
||||
q->size++;
|
||||
return true;
|
||||
if (queue_is_full(q)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
struct u_sink_queue_elem *elem = U_TYPED_CALLOC(struct u_sink_queue_elem);
|
||||
xrt_frame_reference(&elem->frame, xf);
|
||||
elem->next = NULL;
|
||||
if (q->back == NULL) { // First frame
|
||||
q->front = elem;
|
||||
} else { // Next frame
|
||||
q->back->next = elem;
|
||||
}
|
||||
q->back = elem;
|
||||
q->size++;
|
||||
return true;
|
||||
}
|
||||
|
||||
//! Clears the queue and unreferences all of its frames.
|
||||
|
|
Loading…
Reference in a new issue