[vlc-devel] commit: visual: no need to strdup the name of the effect as it' s only use with strcmp. ( Rémi Duraffort )

git version control git at videolan.org
Sat May 30 11:27:58 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat May 30 11:15:13 2009 +0200| [d6c0a9652fdf18bb83ca8fd2b9deb34e7b82317e] | committer: Rémi Duraffort 

visual: no need to strdup the name of the effect as it's only use with strcmp.

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

 modules/visualization/visual/visual.c |    7 ++-----
 modules/visualization/visual/visual.h |    8 ++++----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 27055e2..70536a6 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * visual.c : Visualisation system
  *****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
+ * Copyright (C) 2002-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub at via.ecp.fr>
@@ -243,7 +243,7 @@ static int Open( vlc_object_t *p_this )
                               strlen( pf_effect_run[i].psz_name ) ) )
             {
                 p_effect->pf_run = pf_effect_run[i].pf_run;
-                p_effect->psz_name = strdup( pf_effect_run[i].psz_name );
+                p_effect->psz_name = pf_effect_run[i].psz_name;
                 break;
             }
         }
@@ -261,7 +261,6 @@ static int Open( vlc_object_t *p_this )
                 if( ( psz_eoa = strchr( psz_parser, '}') ) == NULL )
                 {
                    msg_Err( p_filter, "unable to parse effect list. Aborting");
-                   free( p_effect->psz_name );
                    free( p_effect );
                    break;
                 }
@@ -314,7 +313,6 @@ static int Open( vlc_object_t *p_this )
         msg_Err( p_filter, "no suitable vout module" );
         for( int i = 0; i < p_sys->i_effect; i++ )
         {
-            free( p_sys->effect[i]->psz_name );
             free( p_sys->effect[i]->psz_args );
             free( p_sys->effect[i] );
         }
@@ -404,7 +402,6 @@ static void Close( vlc_object_t *p_this )
             free( ( ( spectrum_data * )p_effect->p_data )->prev_heights );
         }
         free( p_effect->p_data );
-        free( p_effect->psz_name );
         free( p_effect->psz_args );
         free( p_effect );
 #undef p_effect
diff --git a/modules/visualization/visual/visual.h b/modules/visualization/visual/visual.h
index 415d69f..11edd58 100644
--- a/modules/visualization/visual/visual.h
+++ b/modules/visualization/visual/visual.h
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * visual.h : Header for the visualisation system
  *****************************************************************************
- * Copyright (C) 2002 the VideoLAN team
+ * Copyright (C) 2002-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Clément Stenac <zorglub at via.ecp.fr>
@@ -23,10 +23,10 @@
 
 typedef struct visual_effect_t
 {
-    char *     psz_name;    /* Filter name*/
+    const char *psz_name;    /* Filter name*/
 
-    int         (*pf_run)( struct visual_effect_t * , aout_instance_t *,
-                           aout_buffer_t *, picture_t *);
+    int        (*pf_run)( struct visual_effect_t * , aout_instance_t *,
+                          aout_buffer_t *, picture_t *);
     void *     p_data; /* The effect stores whatever it wants here */
     int        i_width;
     int        i_height;




More information about the vlc-devel mailing list