[vlc-commits] variables: use const char * for VLC_VAR_SETTEXT

Rémi Denis-Courmont git at videolan.org
Sun Jun 10 12:11:20 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun  9 14:46:51 2018 +0300| [82fa2d678a6577ee968b005c1cd9866f73bc2c71] | committer: Rémi Denis-Courmont

variables: use const char * for VLC_VAR_SETTEXT

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

 modules/access/v4l2/controls.c              |  9 ++---
 modules/gui/skins2/src/theme_repository.cpp |  9 ++---
 modules/video_filter/postproc.c             |  5 +--
 modules/video_output/win32/direct3d9.c      |  4 +-
 modules/video_output/win32/directdraw.c     |  4 +-
 src/audio_output/output.c                   | 20 ++++------
 src/input/var.c                             | 61 ++++++++++++-----------------
 src/interface/interface.c                   |  5 +--
 src/misc/variables.c                        |  7 +---
 src/video_output/interlacing.c              |  9 ++---
 src/video_output/vout_intf.c                | 27 +++++--------
 11 files changed, 63 insertions(+), 97 deletions(-)

diff --git a/modules/access/v4l2/controls.c b/modules/access/v4l2/controls.c
index 54954a8c50..9f3c3e1467 100644
--- a/modules/access/v4l2/controls.c
+++ b/modules/access/v4l2/controls.c
@@ -727,11 +727,11 @@ vlc_v4l2_ctrl_t *ControlsInit (vlc_object_t *obj, int fd)
         vlc_v4l2_ctrl_t *c = handler (obj, fd, &query);
         if (c != NULL)
         {
-            vlc_value_t val, text;
+            vlc_value_t val;
 
             var_AddCallback (obj, c->name, ControlSetCallback, c);
-            text.psz_string = (char *)query.name;
-            var_Change(obj, c->name, VLC_VAR_SETTEXT, &text);
+            var_Change(obj, c->name, VLC_VAR_SETTEXT,
+                       (const char *)query.name);
             val.i_int = query.id;
             var_Change(obj, "controls", VLC_VAR_ADDCHOICE, val,
                        (const char *)c->name);
@@ -765,8 +765,7 @@ vlc_v4l2_ctrl_t *ControlsInit (vlc_object_t *obj, int fd)
         vlc_value_t val;
 
         var_Create (obj, "reset", VLC_VAR_VOID | VLC_VAR_ISCOMMAND);
-        val.psz_string = _("Reset defaults");
-        var_Change(obj, "reset", VLC_VAR_SETTEXT, &val);
+        var_Change(obj, "reset", VLC_VAR_SETTEXT, _("Reset defaults"));
         val.i_int = -1;
 
         var_Change(obj, "controls", VLC_VAR_ADDCHOICE, val, "reset");
diff --git a/modules/gui/skins2/src/theme_repository.cpp b/modules/gui/skins2/src/theme_repository.cpp
index 7f2d444986..bef3074859 100644
--- a/modules/gui/skins2/src/theme_repository.cpp
+++ b/modules/gui/skins2/src/theme_repository.cpp
@@ -51,12 +51,11 @@ void ThemeRepository::destroy( intf_thread_t *pIntf )
 
 ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
 {
-    vlc_value_t val, text;
+    vlc_value_t val;
 
     // Create a variable to add items in wxwindows popup menu
     var_Create( pIntf, "intf-skins", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
-    text.psz_string = (char *)_("Select skin");
-    var_Change( pIntf, "intf-skins", VLC_VAR_SETTEXT, &text );
+    var_Change( pIntf, "intf-skins", VLC_VAR_SETTEXT, _("Select skin") );
 
     // Scan vlt files in the resource path
     OSFactory *pOsFactory = OSFactory::instance( pIntf );
@@ -112,8 +111,8 @@ ThemeRepository::ThemeRepository( intf_thread_t *pIntf ): SkinObject( pIntf )
     // variable for opening a dialog box to change skins
     var_Create( pIntf, "intf-skins-interactive", VLC_VAR_VOID |
                 VLC_VAR_ISCOMMAND );
-    text.psz_string = (char *)_("Open skin...");
-    var_Change( pIntf, "intf-skins-interactive", VLC_VAR_SETTEXT, &text );
+    var_Change( pIntf, "intf-skins-interactive", VLC_VAR_SETTEXT,
+                _("Open skin...") );
 
     // Set the callback
     var_AddCallback( pIntf, "intf-skins-interactive", changeSkin, this );
diff --git a/modules/video_filter/postproc.c b/modules/video_filter/postproc.c
index ee2469fc90..6b4fbfb133 100644
--- a/modules/video_filter/postproc.c
+++ b/modules/video_filter/postproc.c
@@ -198,9 +198,8 @@ static int OpenPostproc( vlc_object_t *p_this )
 
     var_Create( p_filter, FILTER_PREFIX "q", VLC_VAR_INTEGER |
                 VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
-
-    text.psz_string = _("Post processing");
-    var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_SETTEXT, &text );
+    var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_SETTEXT,
+                _("Post processing") );
 
     var_Get( p_filter, FILTER_PREFIX "q", &val_orig );
     var_Change( p_filter, FILTER_PREFIX "q", VLC_VAR_DELCHOICE, val_orig );
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 8a06082f5d..b098d736a7 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -316,9 +316,7 @@ static int Open(vlc_object_t *object)
     sys->ch_desktop = false;
     sys->desktop_requested = sys->sys.use_desktop;
 
-    vlc_value_t val;
-    val.psz_string = _("Desktop");
-    var_Change(vd, "video-wallpaper", VLC_VAR_SETTEXT, &val);
+    var_Change(vd, "video-wallpaper", VLC_VAR_SETTEXT, _("Desktop"));
     var_AddCallback(vd, "video-wallpaper", DesktopCallback, NULL);
 
     /* Setup vout_display now that everything is fine */
diff --git a/modules/video_output/win32/directdraw.c b/modules/video_output/win32/directdraw.c
index bcde25af91..0af3ba03f9 100644
--- a/modules/video_output/win32/directdraw.c
+++ b/modules/video_output/win32/directdraw.c
@@ -242,9 +242,7 @@ static int Open(vlc_object_t *object)
     sys->wallpaper_requested = sys->use_wallpaper;
     sys->use_wallpaper = false;
 
-    vlc_value_t val;
-    val.psz_string = _("Wallpaper");
-    var_Change(vd, "video-wallpaper", VLC_VAR_SETTEXT, &val);
+    var_Change(vd, "video-wallpaper", VLC_VAR_SETTEXT, _("Wallpaper"));
     var_AddCallback(vd, "video-wallpaper", WallpaperCallback, NULL);
 
     /* Setup vout_display now that everything is fine */
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 724ac44cf6..6d3f3c7125 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -224,7 +224,7 @@ static void aout_OutputUnlock(audio_output_t *aout)
  */
 audio_output_t *aout_New (vlc_object_t *parent)
 {
-    vlc_value_t val, text;
+    vlc_value_t val;
 
     audio_output_t *aout = vlc_custom_create (parent, sizeof (aout_instance_t),
                                               "audio output");
@@ -275,8 +275,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
 
     /* Visualizations */
     var_Create (aout, "visual", VLC_VAR_STRING);
-    text.psz_string = _("Visualizations");
-    var_Change(aout, "visual", VLC_VAR_SETTEXT, &text);
+    var_Change(aout, "visual", VLC_VAR_SETTEXT, _("Visualizations"));
     val.psz_string = (char *)"";
     var_Change(aout, "visual", VLC_VAR_ADDCHOICE, val, _("Disable"));
     val.psz_string = (char *)"spectrometer";
@@ -320,21 +319,20 @@ audio_output_t *aout_New (vlc_object_t *parent)
 
     var_Create (aout, "audio-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
     var_AddCallback (aout, "audio-filter", FilterCallback, NULL);
-    text.psz_string = _("Audio filters");
-    var_Change(aout, "audio-filter", VLC_VAR_SETTEXT, &text);
+    var_Change(aout, "audio-filter", VLC_VAR_SETTEXT, _("Audio filters"));
 
     var_Create (aout, "viewpoint", VLC_VAR_ADDRESS );
     var_AddCallback (aout, "viewpoint", ViewpointCallback, NULL);
 
     var_Create (aout, "audio-visual", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
-    text.psz_string = _("Audio visualizations");
-    var_Change(aout, "audio-visual", VLC_VAR_SETTEXT, &text);
+    var_Change(aout, "audio-visual", VLC_VAR_SETTEXT,
+               _("Audio visualizations"));
 
     /* Replay gain */
     var_Create (aout, "audio-replay-gain-mode",
                 VLC_VAR_STRING | VLC_VAR_DOINHERIT );
-    text.psz_string = _("Replay gain");
-    var_Change(aout, "audio-replay-gain-mode", VLC_VAR_SETTEXT, &text);
+    var_Change(aout, "audio-replay-gain-mode", VLC_VAR_SETTEXT,
+               _("Replay gain"));
     cfg = config_FindConfig("audio-replay-gain-mode");
     if (likely(cfg != NULL))
         for (unsigned i = 0; i < cfg->list_count; i++)
@@ -349,9 +347,7 @@ audio_output_t *aout_New (vlc_object_t *parent)
     owner->requested_stereo_mode = var_GetInteger (aout, "stereo-mode");
 
     var_AddCallback (aout, "stereo-mode", StereoModeCallback, NULL);
-    vlc_value_t txt;
-    txt.psz_string = _("Stereo audio mode");
-    var_Change(aout, "stereo-mode", VLC_VAR_SETTEXT, &txt);
+    var_Change(aout, "stereo-mode", VLC_VAR_SETTEXT, _("Stereo audio mode"));
 
     /* Equalizer */
     var_Create (aout, "equalizer-preamp", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);
diff --git a/src/input/var.c b/src/input/var.c
index ad1d1d9e74..04c8cb0861 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -128,7 +128,7 @@ static const vlc_input_callback_t p_input_title_navigation_callbacks[] =
  *****************************************************************************/
 void input_ControlVarInit ( input_thread_t *p_input )
 {
-    vlc_value_t val, text;
+    vlc_value_t val;
 
     /* State */
     var_Create( p_input, "state", VLC_VAR_INTEGER );
@@ -149,31 +149,26 @@ void input_ControlVarInit ( input_thread_t *p_input )
 
     /* Bookmark */
     var_Create( p_input, "bookmark", VLC_VAR_INTEGER | VLC_VAR_ISCOMMAND );
-    val.psz_string = _("Bookmark");
-    var_Change( p_input, "bookmark", VLC_VAR_SETTEXT, &val );
+    var_Change( p_input, "bookmark", VLC_VAR_SETTEXT, _("Bookmark") );
 
     /* Program */
     var_Create( p_input, "program", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     var_Get( p_input, "program", &val );
     if( val.i_int <= 0 )
         var_Change( p_input, "program", VLC_VAR_DELCHOICE, val );
-    text.psz_string = _("Program");
-    var_Change( p_input, "program", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "program", VLC_VAR_SETTEXT, _("Program") );
 
     /* Programs */
     var_Create( p_input, "programs", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
-    text.psz_string = _("Programs");
-    var_Change( p_input, "programs", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "programs", VLC_VAR_SETTEXT, _("Programs") );
 
     /* Title */
     var_Create( p_input, "title", VLC_VAR_INTEGER );
-    text.psz_string = _("Title");
-    var_Change( p_input, "title", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "title", VLC_VAR_SETTEXT, _("Title") );
 
     /* Chapter */
     var_Create( p_input, "chapter", VLC_VAR_INTEGER );
-    text.psz_string = _("Chapter");
-    var_Change( p_input, "chapter", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "chapter", VLC_VAR_SETTEXT, _("Chapter") );
 
     /* Delay */
     var_Create( p_input, "audio-delay", VLC_VAR_INTEGER );
@@ -185,20 +180,17 @@ void input_ControlVarInit ( input_thread_t *p_input )
     /* Video ES */
     var_Create( p_input, "video-es", VLC_VAR_INTEGER );
     var_Change( p_input, "video-es", VLC_VAR_SETVALUE, val );
-    text.psz_string = _("Video Track");
-    var_Change( p_input, "video-es", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "video-es", VLC_VAR_SETTEXT, _("Video Track") );
 
     /* Audio ES */
     var_Create( p_input, "audio-es", VLC_VAR_INTEGER );
     var_Change( p_input, "audio-es", VLC_VAR_SETVALUE, val );
-    text.psz_string = _("Audio Track");
-    var_Change( p_input, "audio-es", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "audio-es", VLC_VAR_SETTEXT, _("Audio Track") );
 
     /* Spu ES */
     var_Create( p_input, "spu-es", VLC_VAR_INTEGER );
     var_Change( p_input, "spu-es", VLC_VAR_SETVALUE, val );
-    text.psz_string = _("Subtitle Track");
-    var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text );
+    var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, _("Subtitle Track") );
 
     var_Create( p_input, "spu-choice", VLC_VAR_INTEGER );
     var_SetInteger( p_input, "spu-choice", -1 );
@@ -254,36 +246,34 @@ void input_ControlVarStop( input_thread_t *p_input )
  *****************************************************************************/
 void input_ControlVarNavigation( input_thread_t *p_input )
 {
-    vlc_value_t text;
-
     /* Create more command variables */
     if( input_priv(p_input)->i_title > 1 )
     {
         if( var_Type( p_input, "next-title" ) == 0 ) {
             var_Create( p_input, "next-title", VLC_VAR_VOID );
-            text.psz_string = _("Next title");
-            var_Change( p_input, "next-title", VLC_VAR_SETTEXT, &text );
+            var_Change( p_input, "next-title", VLC_VAR_SETTEXT,
+                        _("Next title") );
             var_AddCallback( p_input, "next-title", TitleCallback, NULL );
         }
 
         if( var_Type( p_input, "prev-title" ) == 0 ) {
             var_Create( p_input, "prev-title", VLC_VAR_VOID );
-            text.psz_string = _("Previous title");
-            var_Change( p_input, "prev-title", VLC_VAR_SETTEXT, &text );
+            var_Change( p_input, "prev-title", VLC_VAR_SETTEXT,
+                        _("Previous title") );
             var_AddCallback( p_input, "prev-title", TitleCallback, NULL );
         }
 
         if( var_Type( p_input, "menu-title" ) == 0 ) {
             var_Create( p_input, "menu-title", VLC_VAR_VOID );
-            text.psz_string = _("Menu title");
-            var_Change( p_input, "menu-title", VLC_VAR_SETTEXT, &text );
+            var_Change( p_input, "menu-title", VLC_VAR_SETTEXT,
+                        _("Menu title") );
             var_AddCallback( p_input, "menu-title", TitleCallback, NULL );
         }
 
         if( var_Type( p_input, "menu-popup" ) == 0 ) {
             var_Create( p_input, "menu-popup", VLC_VAR_VOID );
-            text.psz_string = _("Menu popup");
-            var_Change( p_input, "menu-popup", VLC_VAR_SETTEXT, &text );
+            var_Change( p_input, "menu-popup", VLC_VAR_SETTEXT,
+                        _("Menu popup") );
             var_AddCallback( p_input, "menu-popup", TitleCallback, NULL );
         }
     }
@@ -313,16 +303,17 @@ void input_ControlVarNavigation( input_thread_t *p_input )
         else
             psz_length[0] = '\0';
 
+        char *titlestr;
         if( input_priv(p_input)->title[i]->psz_name == NULL ||
             *input_priv(p_input)->title[i]->psz_name == '\0' )
         {
-            if( asprintf( &text.psz_string, _("Title %i%s"),
+            if( asprintf( &titlestr, _("Title %i%s"),
                           i + input_priv(p_input)->i_title_offset, psz_length ) == -1 )
                 continue;
         }
         else
         {
-            if( asprintf( &text.psz_string, "%s%s",
+            if( asprintf( &titlestr, "%s%s",
                           input_priv(p_input)->title[i]->psz_name, psz_length ) == -1 )
                 continue;
         }
@@ -330,9 +321,9 @@ void input_ControlVarNavigation( input_thread_t *p_input )
         /* Add title choice */
         val2.i_int = i;
         var_Change( p_input, "title", VLC_VAR_ADDCHOICE, val2,
-                    (const char *)text.psz_string );
+                    (const char *)titlestr );
 
-        free( text.psz_string );
+        free( titlestr );
 
         for( int j = 0; j < input_priv(p_input)->title[i]->i_seekpoint; j++ )
         {
@@ -379,13 +370,13 @@ void input_ControlVarTitle( input_thread_t *p_input, int i_title )
     else if( var_Type( p_input, "next-chapter" ) == 0 )
     {
         var_Create( p_input, "next-chapter", VLC_VAR_VOID );
-        text.psz_string = _("Next chapter");
-        var_Change( p_input, "next-chapter", VLC_VAR_SETTEXT, &text );
+        var_Change( p_input, "next-chapter", VLC_VAR_SETTEXT,
+                    _("Next chapter") );
         var_AddCallback( p_input, "next-chapter", SeekpointCallback, NULL );
 
         var_Create( p_input, "prev-chapter", VLC_VAR_VOID );
-        text.psz_string = _("Previous chapter");
-        var_Change( p_input, "prev-chapter", VLC_VAR_SETTEXT, &text );
+        var_Change( p_input, "prev-chapter", VLC_VAR_SETTEXT,
+                    _("Previous chapter") );
         var_AddCallback( p_input, "prev-chapter", SeekpointCallback, NULL );
     }
 
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 8712669cc9..9910463065 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -77,10 +77,9 @@ int intf_Create( playlist_t *playlist, const char *chain )
         return VLC_ENOMEM;
 
     /* Variable used for interface spawning */
-    vlc_value_t val, text;
+    vlc_value_t val;
     var_Create( p_intf, "intf-add", VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
-    text.psz_string = _("Add Interface");
-    var_Change( p_intf, "intf-add", VLC_VAR_SETTEXT, &text );
+    var_Change( p_intf, "intf-add", VLC_VAR_SETTEXT, _("Add Interface") );
 #if !defined(_WIN32) && defined(HAVE_ISATTY)
     if( isatty( 0 ) )
 #endif
diff --git a/src/misc/variables.c b/src/misc/variables.c
index 5a07cbc926..83498dadc5 100644
--- a/src/misc/variables.c
+++ b/src/misc/variables.c
@@ -583,13 +583,10 @@ int (var_Change)(vlc_object_t *p_this, const char *psz_name, int i_action, ...)
         }
         case VLC_VAR_SETTEXT:
         {
-            const vlc_value_t *p_val = va_arg(ap, vlc_value_t *);
+            const char *text = va_arg(ap, const char *);
 
             free( p_var->psz_text );
-            if( p_val && p_val->psz_string )
-                p_var->psz_text = strdup( p_val->psz_string );
-            else
-                p_var->psz_text = NULL;
+            p_var->psz_text = (text != NULL) ? strdup(text) : NULL;
             break;
         }
         case VLC_VAR_GETTEXT:
diff --git a/src/video_output/interlacing.c b/src/video_output/interlacing.c
index 1093a50b58..3451bb5095 100644
--- a/src/video_output/interlacing.c
+++ b/src/video_output/interlacing.c
@@ -98,7 +98,7 @@ static int DeinterlaceCallback(vlc_object_t *object, char const *cmd,
 
 void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
 {
-    vlc_value_t val, text;
+    vlc_value_t val;
 
     msg_Dbg(vout, "Deinterlacing available");
 
@@ -109,8 +109,7 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
     var_Create(vout, "deinterlace", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
     int deinterlace_state = var_GetInteger(vout, "deinterlace");
 
-    text.psz_string = _("Deinterlace");
-    var_Change(vout, "deinterlace", VLC_VAR_SETTEXT, &text);
+    var_Change(vout, "deinterlace", VLC_VAR_SETTEXT, _("Deinterlace"));
 
     const module_config_t *optd = config_FindConfig("deinterlace");
     var_Change(vout, "deinterlace", VLC_VAR_CLEARCHOICES);
@@ -125,8 +124,8 @@ void vout_InitInterlacingSupport(vout_thread_t *vout, bool is_interlaced)
     var_Create(vout, "deinterlace-mode", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
     char *deinterlace_mode = var_GetNonEmptyString(vout, "deinterlace-mode");
 
-    text.psz_string = _("Deinterlace mode");
-    var_Change(vout, "deinterlace-mode", VLC_VAR_SETTEXT, &text);
+    var_Change(vout, "deinterlace-mode", VLC_VAR_SETTEXT,
+               _("Deinterlace mode"));
 
     const module_config_t *optm = config_FindConfig("deinterlace-mode");
     var_Change(vout, "deinterlace-mode", VLC_VAR_CLEARCHOICES);
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 4ce5734fe6..b4ea07aa9e 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -149,7 +149,7 @@ static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
 
 void vout_IntfInit( vout_thread_t *p_vout )
 {
-    vlc_value_t val, text;
+    vlc_value_t val;
     char *psz_buf;
 
     /* Create a few object variables we'll need later on */
@@ -166,15 +166,12 @@ void vout_IntfInit( vout_thread_t *p_vout )
     /* Add variables to manage scaling video */
     var_Create( p_vout, "autoscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
                 | VLC_VAR_ISCOMMAND );
-    text.psz_string = _("Autoscale video");
-    var_Change( p_vout, "autoscale", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "autoscale", VLC_VAR_SETTEXT, _("Autoscale video") );
     var_AddCallback( p_vout, "autoscale", AutoScaleCallback, NULL );
 
     var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND |
                 VLC_VAR_DOINHERIT );
-
-    text.psz_string = _("Zoom");
-    var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "zoom", VLC_VAR_SETTEXT, _("Zoom") );
 
     for( size_t i = 0; i < ARRAY_SIZE(p_zoom_values); i++ )
     {
@@ -199,9 +196,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
     /* Crop object var */
     var_Create( p_vout, "crop", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
                 VLC_VAR_DOINHERIT );
-
-    text.psz_string = _("Crop");
-    var_Change( p_vout, "crop", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "crop", VLC_VAR_SETTEXT, _("Crop") );
 
     for( size_t i = 0; i < ARRAY_SIZE(p_crop_values); i++ )
     {
@@ -226,9 +221,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
     /* Aspect-ratio object var */
     var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_ISCOMMAND |
                 VLC_VAR_DOINHERIT );
-
-    text.psz_string = _("Aspect ratio");
-    var_Change( p_vout, "aspect-ratio", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "aspect-ratio", VLC_VAR_SETTEXT, _("Aspect ratio") );
 
     for( size_t i = 0; i < ARRAY_SIZE(p_aspect_ratio_values); i++ )
     {
@@ -250,8 +243,8 @@ void vout_IntfInit( vout_thread_t *p_vout )
     /* Add a variable to indicate if the window should be on top of others */
     var_Create( p_vout, "video-on-top", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
                 | VLC_VAR_ISCOMMAND );
-    text.psz_string = _("Always on top");
-    var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "video-on-top", VLC_VAR_SETTEXT,
+                _("Always on top") );
     var_AddCallback( p_vout, "video-on-top", AboveCallback, NULL );
 
     /* Add a variable to indicate if the window should be below all others */
@@ -265,14 +258,12 @@ void vout_IntfInit( vout_thread_t *p_vout )
     /* Add a fullscreen variable */
     var_Create( p_vout, "fullscreen",
                 VLC_VAR_BOOL | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
-    text.psz_string = _("Fullscreen");
-    var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, _("Fullscreen") );
     var_AddCallback( p_vout, "fullscreen", FullscreenCallback, NULL );
 
     /* Add a snapshot variable */
     var_Create( p_vout, "video-snapshot", VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
-    text.psz_string = _("Snapshot");
-    var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, &text );
+    var_Change( p_vout, "video-snapshot", VLC_VAR_SETTEXT, _("Snapshot") );
     var_AddCallback( p_vout, "video-snapshot", SnapshotCallback, NULL );
 
     /* Add a video-filter variable */



More information about the vlc-commits mailing list