Skip to content
Snippets Groups Projects
Commit 1b46969f authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

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
parent eb37f4e5
No related branches found
No related tags found
No related merge requests found
...@@ -193,9 +193,18 @@ gst_queue_array_find (GstQueueArray * array, GCompareFunc func, gpointer data) ...@@ -193,9 +193,18 @@ gst_queue_array_find (GstQueueArray * array, GCompareFunc func, gpointer data)
{ {
guint i; guint i;
/* Scan from head to tail */ if (func != NULL) {
for (i = 0; i < array->length; i++) /* Scan from head to tail */
if (func (array->array[(i + array->head) % array->size], data) == 0) for (i = 0; i < array->length; i++) {
return (i + array->head) % array->size; 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; return -1;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment