[vlc-devel] [vlc-commits] commit: epg: remove dummy cast. ( Rémi Duraffort )
fenrir at elivagar.org
Tue Oct 5 20:31:24 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.
More information about the vlc-devel