[vlc-devel] commit: variables: Don't sort the choice list here. Because, the algo is bad and because we can' t set the order of the list ourselves then. (Pierre d'Herbemont )

git version control git at videolan.org
Thu Jul 24 00:01:52 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Wed Jul 23 20:23:06 2008 +0200| [3a57140d761afe12d2d4ee04218ccae446478302]

variables: Don't sort the choice list here. Because, the algo is bad and because we can't set the order of the list ourselves then.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3a57140d761afe12d2d4ee04218ccae446478302
---

 src/misc/variables.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/src/misc/variables.c b/src/misc/variables.c
index 45d15cf..ed5f31a 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -473,22 +473,7 @@ int __var_Change( vlc_object_t *p_this, const char *psz_name,
             }
             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 );
@@ -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:
-            /* 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 )




More information about the vlc-devel mailing list