[MPlayer-cvslog] r30744 - in trunk: TOOLS/bmovl-test.c TOOLS/vfw2menc.c asxparser.c gui/win32/dialogs.c gui/win32/widgetrender.c libao2/ao_coreaudio.c libmenu/menu_filesel.c libmpcodecs/ad_libmad.c libmpcodecs/ae.c...

Reimar Döffinger Reimar.Doeffinger at gmx.de
Fri Feb 26 23:36:00 CET 2010


On Fri, Feb 26, 2010 at 10:48:00PM +0100, Diego Biurrun wrote:
> On Fri, Feb 26, 2010 at 04:01:37PM +0100, diego wrote:
> > 
> > Log:
> > Do not cast the results of malloc/calloc/realloc.
> > These functions return void*, which is compatible with any pointer,
> > so there is no need for casts.
> > 
> > --- trunk/libmpdemux/demuxer.h	Fri Feb 26 13:49:49 2010	(r30743)
> > +++ trunk/libmpdemux/demuxer.h	Fri Feb 26 16:01:37 2010	(r30744)
> > @@ -261,7 +261,7 @@ typedef struct {
> >  } demux_program_t;
> >  
> >  static inline demux_packet_t* new_demux_packet(int len){
> > -  demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t));
> > +  demux_packet_t* dp = malloc(sizeof(demux_packet_t));
> >    dp->len=len;
> 
> Crap, this gets included from the C++ live555 glue code and breaks there.
> Is there an alternative to just reverting this?

Well... splitting the glue code further so that the part that is C++ does
not need to include any MPlayer headers.
And in this specific case: remove that function from the header.
At least I fail to see a good reason for it to be in the header instead of the C file,
the malloc is going to be vastly slower than a function call, that is sure...


More information about the MPlayer-cvslog mailing list