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:
Tim-Philipp Müller 2013-01-30 11:55:18 +00:00
parent eb37f4e590
commit 1b46969f7e

View file

@ -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;
}