[vlc-devel] commit: No need to check for the existence of the variable to destroy it. ( Rémi Duraffort )

git version control git at videolan.org
Fri Jul 24 09:34:42 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jul 24 09:05:58 2009 +0200| [5f65c5c91055c4a3e861dfbfa8d70547c466d12a] | committer: Rémi Duraffort 

No need to check for the existence of the variable to destroy it.
Destroying directly saves one Lookup.

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

 src/audio_output/dec.c  |   10 ++--------
 src/audio_output/intf.c |   15 +++------------
 2 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index b31b02f..a0bbe37 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -231,14 +231,8 @@ int aout_DecDelete( aout_instance_t * p_aout, aout_input_t * p_input )
     {
         aout_OutputDelete( p_aout );
         aout_MixerDelete( p_aout );
-        if ( var_Type( p_aout, "audio-device" ) != 0 )
-        {
-            var_Destroy( p_aout, "audio-device" );
-        }
-        if ( var_Type( p_aout, "audio-channels" ) != 0 )
-        {
-            var_Destroy( p_aout, "audio-channels" );
-        }
+        var_Destroy( p_aout, "audio-device" );
+        var_Destroy( p_aout, "audio-channels" );
     }
 
     aout_unlock_mixer( p_aout );
diff --git a/src/audio_output/intf.c b/src/audio_output/intf.c
index e20ecfd..db9d64a 100644
--- a/src/audio_output/intf.c
+++ b/src/audio_output/intf.c
@@ -440,14 +440,8 @@ int aout_FindAndRestart( vlc_object_t * p_this, const char *psz_name,
     (void)psz_name; (void)oldval; (void)newval; (void)p_data;
     if ( p_aout == NULL ) return VLC_SUCCESS;
 
-    if ( var_Type( p_aout, "audio-device" ) != 0 )
-    {
-        var_Destroy( p_aout, "audio-device" );
-    }
-    if ( var_Type( p_aout, "audio-channels" ) != 0 )
-    {
-        var_Destroy( p_aout, "audio-channels" );
-    }
+    var_Destroy( p_aout, "audio-device" );
+    var_Destroy( p_aout, "audio-channels" );
 
     aout_Restart( p_aout );
     vlc_object_release( p_aout );
@@ -469,10 +463,7 @@ int aout_ChannelsRestart( vlc_object_t * p_this, const char * psz_variable,
     {
         /* This is supposed to be a significant change and supposes
          * rebuilding the channel choices. */
-        if ( var_Type( p_aout, "audio-channels" ) >= 0 )
-        {
-            var_Destroy( p_aout, "audio-channels" );
-        }
+        var_Destroy( p_aout, "audio-channels" );
     }
     aout_Restart( p_aout );
     return 0;




More information about the vlc-devel mailing list