- p_list[ i_index ].p_module = p_module;
- p_list[ i_index ].i_score = p_module->i_score + i_shortcut_bonus;
- p_list[ i_index ].b_force = i_shortcut_bonus && b_strict;
-
- /* Add it to the modules-to-probe list */
- if( i_index == 0 )
- {
- p_list[ 0 ].p_next = NULL;
- p_first = p_list;
- }
- else
- {
- /* Ok, so at school you learned that quicksort is quick, and
- * bubble sort sucks raw eggs. But that's when dealing with
- * thousands of items. Here we have barely 50. */
- module_list_t *p_newlist = p_first;
-
- if( p_first->i_score < p_list[ i_index ].i_score )
- {
- p_list[ i_index ].p_next = p_first;
- p_first = &p_list[ i_index ];
- }
- else
- {
- while( p_newlist->p_next != NULL &&
- p_newlist->p_next->i_score >= p_list[ i_index ].i_score )
- {
- p_newlist = p_newlist->p_next;
- }
-
- p_list[ i_index ].p_next = p_newlist->p_next;
- p_newlist->p_next = &p_list[ i_index ];
- }
- }
-
- i_index++;
- }
-
- msg_Dbg( p_this, "looking for %s module: %i candidate%s", psz_capability,
- i_index, i_index == 1 ? "" : "s" );
-
- /* Lock all candidate modules */
- p_tmp = p_first;
- while( p_tmp != NULL )
- {
- module_hold( p_tmp->p_module );
- p_tmp = p_tmp->p_next;
+ p_list[count].p_module = module_hold (p_module);
+ p_list[count].i_score = p_module->i_score;
+ if( b_shortcut_bonus )
+ p_list[count].i_score += 10000;
+ p_list[count].b_force = b_shortcut_bonus && b_strict;
+ count++;