]> git.sesse.net Git - vlc/commitdiff
Simplification / memory error handling
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 16 Sep 2007 08:49:55 +0000 (08:49 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 16 Sep 2007 08:49:55 +0000 (08:49 +0000)
src/audio_output/input.c
src/audio_output/intf.c
src/input/input.c

index 06daa052b580f5f7567a9ac127e30e4188fa6851..be4e8a22c47484197b94e348ef6453c4bfa00fb1 100644 (file)
@@ -888,7 +888,8 @@ static int ReplayGainCallback( vlc_object_t *p_this, char const *psz_cmd,
 
 static void ReplayGainSelect( aout_instance_t *p_aout, aout_input_t *p_input )
 {
-    char *psz_replay_gain = var_GetString( p_aout, "audio-replay-gain-mode" );
+    char *psz_replay_gain = var_GetNonEmptyString( p_aout,
+                                                   "audio-replay-gain-mode" );
     int i_mode;
     int i_use;
     float f_gain;
index 0deb22b7111a39cafd9ffcb04f8bf4db43f81a96..0f7407331920c8a03de4e297df032760667a9301 100644 (file)
@@ -482,7 +482,7 @@ void aout_EnableFilter( vlc_object_t *p_this, const char *psz_name,
                                                 FIND_ANYWHERE );
 
     if( p_aout )
-        psz_string = var_GetString( p_aout, "audio-filter" );
+        psz_string = var_GetNonEmptyString( p_aout, "audio-filter" );
     else
         psz_string = config_GetPsz( p_this, "audio-filter" );
 
index d5daebfeca623131f9e0d36f9ded42d66e56c41a..b3e7317e5ee4508614ae29c5217f3b7d4c4b32ad 100644 (file)
@@ -790,8 +790,8 @@ static int Init( input_thread_t * p_input )
         }
 
         /* Find a usable sout and attach it to p_input */
-        psz = var_GetString( p_input, "sout" );
-        if( *psz && strncasecmp( p_input->p->input.p_item->psz_uri, "vlc:", 4 ) )
+        psz = var_GetNonEmptyString( p_input, "sout" );
+        if( psz && strncasecmp( p_input->p->input.p_item->psz_uri, "vlc:", 4 ) )
         {
             /* Check the validity of the provided sout */
             if( p_input->p->p_sout )
@@ -985,8 +985,8 @@ static int Init( input_thread_t * p_input )
         }
 
         /* Look for and add subtitle files */
-        psz_subtitle = var_GetString( p_input, "sub-file" );
-        if( *psz_subtitle )
+        psz_subtitle = var_GetNonEmptyString( p_input, "sub-file" );
+        if( psz_subtitle != NULL )
         {
             msg_Dbg( p_input, "forced subtitle: %s", psz_subtitle );
             input_AddSubtitles( p_input, psz_subtitle, VLC_FALSE );
@@ -1003,7 +1003,7 @@ static int Init( input_thread_t * p_input )
 
             /* Try to autoselect the first autodetected subtitles file
              * if no subtitles file was specified */
-            if( *psz_subtitle == 0 && subs && subs[0] )
+            if( ( psz_subtitle == NULL ) && subs && subs[0] )
             {
                 input_AddSubtitles( p_input, subs[0], VLC_FALSE );
                 free( subs[0] );
@@ -1030,8 +1030,8 @@ static int Init( input_thread_t * p_input )
         free( psz_subtitle );
 
         /* Look for slave */
-        psz = var_GetString( p_input, "input-slave" );
-        if( *psz )
+        psz = var_GetNonEmptyString( p_input, "input-slave" );
+        if( psz != NULL )
         {
             char *psz_delim;
             input_source_t *slave;
@@ -1059,8 +1059,8 @@ static int Init( input_thread_t * p_input )
                 else free( slave );
                 psz = psz_delim;
             }
+            free( psz );
         }
-        if( psz ) free( psz );
     }
     else
     {
@@ -2224,7 +2224,7 @@ static int InputSourceInit( input_thread_t *p_input,
         }
 
         /* */
-        psz_tmp = psz = var_GetString( p_input, "access-filter" );
+        psz_tmp = psz = var_GetNonEmptyString( p_input, "access-filter" );
         while( psz && *psz )
         {
             access_t *p_access = in->p_access;
@@ -2243,7 +2243,7 @@ static int InputSourceInit( input_thread_t *p_input,
 
             psz = end;
         }
-        if( psz_tmp ) free( psz_tmp );
+        free( psz_tmp );
 
         /* Get infos from access */
         if( !p_input->b_preparsing )