]> git.sesse.net Git - vlc/commitdiff
variables: Don't sort the choice list here. Because, the algo is bad and because...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 23 Jul 2008 18:23:06 +0000 (20:23 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Wed, 23 Jul 2008 22:04:20 +0000 (00:04 +0200)
src/misc/variables.c

index 45d15cfe5ed62e529fab1dd2d220f97df23f7c26..ed5f31a03d50b9ae628a9b45f85a7782f04ade39 100644 (file)
@@ -473,22 +473,7 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
             }
             break;
         case VLC_VAR_ADDCHOICE:
             }
             break;
         case VLC_VAR_ADDCHOICE:
-            /* FIXME: the list is sorted, dude. Use something cleverer. */
-            for( i = p_var->choices.i_count ; i-- ; )
-            {
-                if( p_var->pf_cmp( p_var->choices.p_values[i], *p_val ) < 0 )
-                {
-                    break;
-                }
-            }
-
-            /* The new place is i+1 */
-            i++;
-
-            if( p_var->i_default >= i )
-            {
-                p_var->i_default++;
-            }
+            i = p_var->choices.i_count;
 
             INSERT_ELEM( p_var->choices.p_values, p_var->choices.i_count,
                          i, *p_val );
 
             INSERT_ELEM( p_var->choices.p_values, p_var->choices.i_count,
                          i, *p_val );
@@ -502,7 +487,6 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
             CheckValue( p_var, &p_var->val );
             break;
         case VLC_VAR_DELCHOICE:
             CheckValue( p_var, &p_var->val );
             break;
         case VLC_VAR_DELCHOICE:
-            /* FIXME: the list is sorted, dude. Use something cleverer. */
             for( i = 0 ; i < p_var->choices.i_count ; i++ )
             {
                 if( p_var->pf_cmp( p_var->choices.p_values[i], *p_val ) == 0 )
             for( i = 0 ; i < p_var->choices.i_count ; i++ )
             {
                 if( p_var->pf_cmp( p_var->choices.p_values[i], *p_val ) == 0 )