-/*****************************************************************************
- * FindIndex: find the index of an object in an array of objects
- *****************************************************************************
- * This function assumes that p_this can be found in pp_objects. It will not
- * crash if p_this cannot be found, but will return a wrong value. It is your
- * duty to check the return value if you are not certain that the object could
- * be found for sure.
- *****************************************************************************/
-static int FindIndex( vlc_object_t *p_this,
- vlc_object_t **pp_objects, int i_count )
-{
- int i_middle = i_count / 2;
-
- if( i_count == 0 )
- {
- return 0;
- }
-
- if( pp_objects[i_middle] == p_this )
- {
- return i_middle;
- }
-
- if( i_count == 1 )
- {
- return 0;
- }
-
- /* We take advantage of the sorted array */
- if( pp_objects[i_middle]->i_object_id < p_this->i_object_id )
- {
- return i_middle + FindIndex( p_this, pp_objects + i_middle,
- i_count - i_middle );
- }
- else
- {
- return FindIndex( p_this, pp_objects, i_middle );
- }
-}
-