[vlc-devel] [PATCH 1/5] variables: rename var_FreeList to var_FreeChoiceLists

Thomas Guillem thomas at gllm.fr
Thu Nov 3 10:16:47 CET 2016


---
 include/vlc_variables.h                         |  2 +-
 lib/audio.c                                     |  2 +-
 lib/media_player.c                              |  2 +-
 lib/video.c                                     |  6 ++---
 modules/control/gestures.c                      |  4 +--
 modules/control/hotkeys.c                       | 36 ++++++++++++-------------
 modules/control/oldrc.c                         |  6 ++---
 modules/gui/macosx/VLCMainMenu.m                |  2 +-
 modules/gui/qt/components/controller_widget.cpp |  2 +-
 modules/gui/qt/components/extended_panels.cpp   |  4 +--
 modules/gui/qt/input_manager.cpp                |  2 +-
 modules/gui/qt/menus.cpp                        |  2 +-
 modules/lua/libs/variables.c                    |  2 +-
 src/input/input.c                               |  2 +-
 src/libvlccore.sym                              |  2 +-
 src/misc/variables.c                            |  5 ++--
 test/src/misc/variables.c                       |  2 +-
 17 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/include/vlc_variables.h b/include/vlc_variables.h
index 83752b1..fa17150 100644
--- a/include/vlc_variables.h
+++ b/include/vlc_variables.h
@@ -144,7 +144,7 @@ VLC_API int var_GetAndSet( vlc_object_t *, const char *, int, vlc_value_t * );
 
 VLC_API int var_Inherit( vlc_object_t *, const char *, int, vlc_value_t * );
 
-VLC_API void var_FreeList( vlc_value_t *, vlc_value_t * );
+VLC_API void var_FreeChoiceLists( vlc_value_t *, vlc_value_t * );
 
 
 /*****************************************************************************
diff --git a/lib/audio.c b/lib/audio.c
index 3aed6f5..c7005ec 100644
--- a/lib/audio.c
+++ b/lib/audio.c
@@ -433,7 +433,7 @@ int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track )
     }
     libvlc_printerr( "Track identifier not found" );
 end:
-    var_FreeList( &val_list, NULL );
+    var_FreeChoiceLists( &val_list, NULL );
     vlc_object_release( p_input_thread );
     return i_ret;
 }
diff --git a/lib/media_player.c b/lib/media_player.c
index db08274..e43cab0 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -1814,7 +1814,7 @@ libvlc_track_description_t *
     }
 
 end:
-    var_FreeList( &val_list, &text_list );
+    var_FreeChoiceLists( &val_list, &text_list );
     vlc_object_release( p_input );
 
     return p_track_description;
diff --git a/lib/video.c b/lib/video.c
index 1046fba..e838422 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -339,7 +339,7 @@ int libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu )
     libvlc_printerr( "Track identifier not found" );
 end:
     vlc_object_release (p_input_thread);
-    var_FreeList (&list, NULL);
+    var_FreeChoiceLists (&list, NULL);
     return i_ret;
 }
 
@@ -494,7 +494,7 @@ void libvlc_toggle_teletext( libvlc_media_player_t *p_mi )
             if( list.p_list->i_count > 0 )
                 var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int );
 
-            var_FreeList( &list, NULL );
+            var_FreeChoiceLists( &list, NULL );
         }
     }
     vlc_object_release( p_input_thread );
@@ -556,7 +556,7 @@ int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track )
     }
     libvlc_printerr( "Track identifier not found" );
 end:
-    var_FreeList( &val_list, NULL );
+    var_FreeChoiceLists( &val_list, NULL );
     vlc_object_release( p_input_thread );
     return i_ret;
 }
diff --git a/modules/control/gestures.c b/modules/control/gestures.c
index 4fc2891..c147c1c 100644
--- a/modules/control/gestures.c
+++ b/modules/control/gestures.c
@@ -303,7 +303,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
                 var_SetInteger( p_input, "audio-es",
                                 list.p_list->p_values[i].i_int );
             }
-            var_FreeList( &list, &list2 );
+            var_FreeChoiceLists( &list, &list2 );
             vlc_object_release( p_input );
             break;
         }
@@ -340,7 +340,7 @@ static void ProcessGesture( intf_thread_t *p_intf )
                 var_SetInteger( p_input, "audio-es",
                                 list.p_list->p_values[i].i_int );
             }
-            var_FreeList( &list, &list2 );
+            var_FreeChoiceLists( &list, &list2 );
             vlc_object_release( p_input );
             break;
         }
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 11bb9bd..0be7a24 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -421,13 +421,13 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 if( i_count < 1 || val.i_int < 0 )
                 {
                     DisplayMessage( p_vout, _("No active subtitle") );
-                    var_FreeList( &list, &list2 );
+                    var_FreeChoiceLists( &list, &list2 );
                     break;
                 }
                 p_sys->subtitle_delaybookmarks.i_time_subtitle = mdate();
                 DisplayMessage( p_vout,
                                 _("Sub sync: bookmarked subtitle time"));
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
         case ACTIONID_SUBSYNC_APPLY:
@@ -490,7 +490,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 if( i_count < 1 || val.i_int < 0 )
                 {
                     DisplayMessage( p_vout, _("No active subtitle") );
-                    var_FreeList( &list, &list2 );
+                    var_FreeChoiceLists( &list, &list2 );
                     break;
                 }
                 int64_t i_delay = var_GetInteger( p_input, "spu-delay" ) + diff;
@@ -499,7 +499,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 ClearChannels( p_intf, p_vout );
                 DisplayMessage( p_vout, _( "Subtitle delay %i ms" ),
                                 (int)(i_delay/1000) );
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
         }
@@ -553,7 +553,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     DisplayMessage( p_vout, _("Audio track: %s"),
                                     list2.p_list->p_values[i].psz_string );
                 }
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
         case ACTIONID_SUBTITLE_TRACK:
@@ -570,7 +570,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 {
                     DisplayMessage( p_vout, _("Subtitle track: %s"),
                                     _("N/A") );
-                    var_FreeList( &list, &list2 );
+                    var_FreeChoiceLists( &list, &list2 );
                     break;
                 }
                 for( i = 0; i < i_count; i++ )
@@ -595,7 +595,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 var_SetInteger( p_input, "spu-choice", list.p_list->p_values[i].i_int );
                 DisplayMessage( p_vout, _("Subtitle track: %s"),
                                 list2.p_list->p_values[i].psz_string );
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
         case ACTIONID_SUBTITLE_TOGGLE:
@@ -613,7 +613,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 {
                     DisplayMessage( p_vout, _("Subtitle track: %s"),
                                     _("N/A") );
-                    var_FreeList( &list, &list2 );
+                    var_FreeChoiceLists( &list, &list2 );
                     break;
                 }
                 for( i_sel_index = 0; i_sel_index < i_count; i_sel_index++ )
@@ -645,7 +645,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 var_SetInteger( p_input, "spu-es", list.p_list->p_values[i_new_index].i_int );
                 DisplayMessage( p_vout, _("Subtitle track: %s"),
                                 list2.p_list->p_values[i_new_index].psz_string );
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
         case ACTIONID_PROGRAM_SID_NEXT:
@@ -663,7 +663,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 {
                     DisplayMessage( p_vout, _("Program Service ID: %s"),
                                     _("N/A") );
-                    var_FreeList( &list, &list2 );
+                    var_FreeChoiceLists( &list, &list2 );
                     break;
                 }
                 for( i = 0; i < i_count; i++ )
@@ -695,7 +695,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 var_Set( p_input, "program", list.p_list->p_values[i] );
                 DisplayMessage( p_vout, _("Program Service ID: %s"),
                                 list2.p_list->p_values[i].psz_string );
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
 
@@ -824,7 +824,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     DisplayMessage( p_vout, _("Aspect ratio: %s"),
                                     text_list.p_list->p_values[i].psz_string );
 
-                    var_FreeList( &val_list, &text_list );
+                    var_FreeChoiceLists( &val_list, &text_list );
                 }
                 free( val.psz_string );
             }
@@ -854,7 +854,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     DisplayMessage( p_vout, _("Crop: %s"),
                                     text_list.p_list->p_values[i].psz_string );
 
-                    var_FreeList( &val_list, &text_list );
+                    var_FreeChoiceLists( &val_list, &text_list );
                 }
                 free( val.psz_string );
             }
@@ -980,7 +980,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     DisplayMessage( p_vout, _("Zoom mode: %s"),
                                     text_list.p_list->p_values[i].psz_string );
 
-                    var_FreeList( &val_list, &text_list );
+                    var_FreeChoiceLists( &val_list, &text_list );
                 }
             }
             break;
@@ -1014,7 +1014,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                         DisplayMessage( p_vout, "%s (%s)", _("Deinterlace on"),
                                         psz_text ? psz_text : psz_mode );
 
-                        var_FreeList( &vlist, &tlist );
+                        var_FreeChoiceLists( &vlist, &tlist );
                     }
                     free( psz_mode );
                 }
@@ -1053,7 +1053,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                                       psz_text ? psz_text : psz_mode );
                     }
 
-                    var_FreeList( &vlist, &tlist );
+                    var_FreeChoiceLists( &vlist, &tlist );
                 }
                 free( psz_mode );
             }
@@ -1075,7 +1075,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 {
                     DisplayMessage( p_vout,
                                     _("Subtitle position: no active subtitle") );
-                    var_FreeList( &list, &list2 );
+                    var_FreeChoiceLists( &list, &list2 );
                     break;
                 }
 
@@ -1087,7 +1087,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
                 ClearChannels( p_intf, p_vout );
                 DisplayMessage( p_vout, _( "Subtitle position %d px" ), i_pos );
-                var_FreeList( &list, &list2 );
+                var_FreeChoiceLists( &list, &list2 );
             }
             break;
         }
diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 37f8e16..289a9b5 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -1130,7 +1130,7 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
                             val.p_list->p_values[i].i_int,
                             text.p_list->p_values[i].psz_string );
             }
-            var_FreeList( &val, &text );
+            var_FreeChoiceLists( &val, &text );
             msg_rc( "+----[ end of %s ]", val_name.psz_string );
         }
         free( val_name.psz_string );
@@ -1601,7 +1601,7 @@ static int VideoConfig( vlc_object_t *p_this, char const *psz_cmd,
             }
             free( psz_value );
         }
-        var_FreeList( &val, &text );
+        var_FreeChoiceLists( &val, &text );
         msg_rc( "+----[ end of %s ]", val_name.psz_string );
 
         free( val_name.psz_string );
@@ -1686,7 +1686,7 @@ static int AudioChannel( vlc_object_t *obj, char const *cmd,
                 msg_rc( "| %"PRId64" - %s", val.p_list->p_values[i].i_int,
                         text.p_list->p_values[i].psz_string );
         }
-        var_FreeList( &val, &text );
+        var_FreeChoiceLists( &val, &text );
         msg_rc( "+----[ end of %s ]", cmd );
     }
     else
diff --git a/modules/gui/macosx/VLCMainMenu.m b/modules/gui/macosx/VLCMainMenu.m
index cad6764..19a3487 100644
--- a/modules/gui/macosx/VLCMainMenu.m
+++ b/modules/gui/macosx/VLCMainMenu.m
@@ -1506,7 +1506,7 @@
 
     /* clean up everything */
     if ((i_type & VLC_VAR_TYPE) == VLC_VAR_STRING) free(val.psz_string);
-    var_FreeList(&val_list, &text_list);
+    var_FreeChoiceLists(&val_list, &text_list);
 }
 
 - (void)toggleVar:(id)sender
diff --git a/modules/gui/qt/components/controller_widget.cpp b/modules/gui/qt/components/controller_widget.cpp
index 5cfb575..258fdc1 100644
--- a/modules/gui/qt/components/controller_widget.cpp
+++ b/modules/gui/qt/components/controller_widget.cpp
@@ -279,7 +279,7 @@ void AspectRatioComboBox::updateRatios()
         addItem( qfu( text_list.p_list->p_values[i].psz_string ),
                  QString( val_list.p_list->p_values[i].psz_string ) );
     setEnabled( true );
-    var_FreeList( &val_list, &text_list );
+    var_FreeChoiceLists( &val_list, &text_list );
     vlc_object_release( p_vout );
 }
 
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index c44bed5..e5ac3d6 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -797,7 +797,7 @@ void ExtV4l2::Refresh( void )
                             if( i_val == val2.p_list->p_values[j].i_int )
                                 combobox->setCurrentIndex( j );
                         }
-                        var_FreeList( &val2, &text2 );
+                        var_FreeChoiceLists( &val2, &text2 );
 
                         CONNECT( combobox, currentIndexChanged( int ), this,
                                  ValueChange( int ) );
@@ -864,7 +864,7 @@ void ExtV4l2::Refresh( void )
                     break;
             }
         }
-        var_FreeList( &val, &text );
+        var_FreeChoiceLists( &val, &text );
         vlc_object_release( p_obj );
     }
     else
diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index 82082c1..ec2ad9d 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -877,7 +877,7 @@ void InputManager::activateTeletext( bool b_enable )
                 i = 0;
             var_SetInteger( p_input, "spu-es", b_enable ? list.p_list->p_values[i].i_int : -1 );
         }
-        var_FreeList( &list, &text );
+        var_FreeChoiceLists( &list, &text );
     }
 }
 
diff --git a/modules/gui/qt/menus.cpp b/modules/gui/qt/menus.cpp
index 8af0317..e8a82d1 100644
--- a/modules/gui/qt/menus.cpp
+++ b/modules/gui/qt/menus.cpp
@@ -1450,7 +1450,7 @@ int VLCMenuBar::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
     currentGroup = NULL;
 
     /* clean up everything */
-    var_FreeList( &val_list, &text_list );
+    var_FreeChoiceLists( &val_list, &text_list );
 
 #undef RADIO_OR_COMMAND
 #undef CURVAL
diff --git a/modules/lua/libs/variables.c b/modules/lua/libs/variables.c
index ad8ba6d..465cb61 100644
--- a/modules/lua/libs/variables.c
+++ b/modules/lua/libs/variables.c
@@ -215,7 +215,7 @@ static int vlclua_var_get_list( lua_State *L )
     vlclua_pushlist( L, val.p_list );
     vlclua_pushlist( L, text.p_list );
 
-    var_FreeList( &val, &text );
+    var_FreeChoiceLists( &val, &text );
     return 2;
 }
 
diff --git a/src/input/input.c b/src/input/input.c
index c811254..e958cb1 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2979,7 +2979,7 @@ static int input_SlaveSourceAdd( input_thread_t *p_input,
         es_out_Control( p_input->p->p_es_out_display, ES_OUT_SET_ES_DEFAULT_BY_ID, i_id );
         es_out_Control( p_input->p->p_es_out_display, ES_OUT_SET_ES_BY_ID, i_id );
     }
-    var_FreeList( &list, NULL );
+    var_FreeChoiceLists( &list, NULL );
 
     return VLC_SUCCESS;
 }
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 8bb2dac..574c62e 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -498,7 +498,7 @@ var_Create
 var_DelCallback
 var_DelListCallback
 var_Destroy
-var_FreeList
+var_FreeChoiceLists
 var_Get
 var_GetAndSet
 var_GetChecked
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 7229611..8c02822 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -1281,11 +1281,12 @@ error:
 }
 
 /**
- * Free a list and the associated strings
+ * Free a list and the associated strings returned by var_Change with the
+ * VLC_VAR_GETCHOICES action
  * @param p_val: the list variable
  * @param p_val2: the variable associated or NULL
  */
-void var_FreeList( vlc_value_t *p_val, vlc_value_t *p_val2 )
+void var_FreeChoiceLists( vlc_value_t *p_val, vlc_value_t *p_val2 )
 {
     switch( p_val->p_list->i_type & VLC_VAR_CLASS )
     {
diff --git a/test/src/misc/variables.c b/test/src/misc/variables.c
index 7469a0c..547375d 100644
--- a/test/src/misc/variables.c
+++ b/test/src/misc/variables.c
@@ -342,7 +342,7 @@ static void test_choices( libvlc_int_t *p_libvlc )
     assert( val.p_list->i_count == 1 && val.p_list->p_values[0].i_int == 1 &&
             val2.p_list->i_count == 1 &&
             !strcmp( val2.p_list->p_values[0].psz_string, "one" ) );
-    var_FreeList( &val, &val2 );
+    var_FreeChoiceLists( &val, &val2 );
 
     var_Change( p_libvlc, "bla", VLC_VAR_CLEARCHOICES, NULL, NULL );
     assert( var_CountChoices( p_libvlc, "bla" ) == 0 );
-- 
2.9.3



More information about the vlc-devel mailing list