[vlc-commits] cdg: use vlc_obj_calloc() and simplify

Rémi Denis-Courmont git at videolan.org
Fri Sep 25 15:53:48 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Sep 25 16:29:53 2020 +0300| [fd62bed4e0436febd3be1c3a87e08c99f2ea41ec] | committer: Rémi Denis-Courmont

cdg: use vlc_obj_calloc() and simplify

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

 modules/codec/cdg.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/modules/codec/cdg.c b/modules/codec/cdg.c
index 0fdfc56f9d..14ece81267 100644
--- a/modules/codec/cdg.c
+++ b/modules/codec/cdg.c
@@ -70,7 +70,6 @@ typedef struct
  * Local prototypes
  *****************************************************************************/
 static int  Open ( vlc_object_t * );
-static void Close( vlc_object_t * );
 
 static int Decode( decoder_t *, block_t * );
 
@@ -86,7 +85,7 @@ vlc_module_begin ()
     set_subcategory( SUBCAT_INPUT_VCODEC )
     set_description( N_("CDG video decoder") )
     set_capability( "video decoder", 1000 )
-    set_callbacks( Open, Close )
+    set_callback( Open )
     add_shortcut( "cdg" )
 vlc_module_end ()
 
@@ -102,7 +101,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* Allocate the memory needed to store the decoder's structure */
-    p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) );
+    p_dec->p_sys = p_sys = vlc_obj_calloc( p_this, 1, sizeof(decoder_sys_t) );
     if( !p_sys )
         return VLC_ENOMEM;
 
@@ -186,17 +185,6 @@ exit:
     return VLCDEC_SUCCESS;
 }
 
-/*****************************************************************************
- * Close: decoder destruction
- *****************************************************************************/
-static void Close( vlc_object_t *p_this )
-{
-    decoder_t *p_dec = (decoder_t *)p_this;
-    decoder_sys_t *p_sys = p_dec->p_sys;
-
-    free( p_sys );
-}
-
 /*****************************************************************************
  * Decoder
  *****************************************************************************/



More information about the vlc-commits mailing list