[vlc-devel] [vlc-commits] commit: epg: remove dummy cast. ( Rémi Duraffort )

Rémi Duraffort ivoire at videolan.org
Wed Oct 6 14:31:31 CEST 2010


> On Tue, Oct 05, 2010 at 08:12:17PM +0200, git at videolan.org wrote:
> >  void vlc_epg_AddEvent( vlc_epg_t *p_epg, int64_t i_start, int i_duration,
> >                         const char *psz_name, const char *psz_short_description, const char *psz_description )
> >  {
> > -    vlc_epg_event_t *p_evt = (vlc_epg_event_t*)malloc( sizeof(vlc_epg_event_t) );
> > +    vlc_epg_event_t *p_evt = malloc( sizeof(vlc_epg_event_t) );
> 
>  If you don't want to cast the malloc, then IMHO en general it is safer to do
> > +    vlc_epg_event_t *p_evt = malloc( sizeof(*p_evt) );
> 
> It avoid typo where you change the type of the variable but forgot to
> change the one in the sizeof().
> Here, as the type declaration is on the same line, the risk is low, but when
> it is not the case, it's easy to mess up.
You are right, I will change it tonight.
I removed the cast mostly because they are unneeded and add some code
without any value (IMHO).

-- 
Rémi Duraffort | ivoire
http://ivoire.dinauz.org/blog/



More information about the vlc-devel mailing list