mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-30 07:42:32 +00:00
queuearray: make _find() find the value if no compare function is provided
Allow NULL as compare function for direct value lookup. https://bugzilla.gnome.org/show_bug.cgi?id=692691 Conflicts: plugins/elements/gstqueuearray.c
This commit is contained in:
parent
eb37f4e590
commit
1b46969f7e
1 changed files with 13 additions and 4 deletions
|
@ -193,9 +193,18 @@ gst_queue_array_find (GstQueueArray * array, GCompareFunc func, gpointer data)
|
|||
{
|
||||
guint i;
|
||||
|
||||
if (func != NULL) {
|
||||
/* Scan from head to tail */
|
||||
for (i = 0; i < array->length; i++)
|
||||
for (i = 0; i < array->length; i++) {
|
||||
if (func (array->array[(i + array->head) % array->size], data) == 0)
|
||||
return (i + array->head) % array->size;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < array->length; i++) {
|
||||
if (array->array[(i + array->head) % array->size] == data)
|
||||
return (i + array->head) % array->size;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue