[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...

Diego Biurrun diego at biurrun.de
Sat Feb 27 10:38:11 CET 2010


On Fri, Feb 26, 2010 at 11:36:00PM +0100, Reimar Döffinger wrote:
> 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.

That could end up being a bit of work...

> 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...

You mean move the functions from demuxer.h to demuxer.c and deinline
them?

Diego


More information about the MPlayer-cvslog mailing list