[MPlayer-dev-eng] [PATCH] libbs2b audio filter

Uoti Urpala uoti.urpala at pp1.inet.fi
Mon Mar 23 17:43:25 CET 2009


On Mon, 2009-03-23 at 18:27 +0300, Andrew Savchenko wrote:
> IMO the best solution is to replace all occurences of 
> malloc/calloc/realloc to their safe wrappers, e.g. 
> xmalloc/xcalloc/xrealloc with return value check and fatal error 
> message and exit() call if NULL is returned; if sane exit attempt 
> is really necessary, signal may be issued and later proceed by 
> sighandler. I do not know why this approach isn't used throughout 
> all mplayer's code. Performance shouldn't be an issue because

I did add something like this (in the git repo).

> > > +        opt_t subopts[] = {
> >
> > const
> 
> I can't do this because initializers are not constant.

You can still declare the table const since it doesn't change after
being declared. The compiler will have to construct it on the stack
rather than have a prepared table in read-only memory, but semantically
it can be const for the duration it exists.

A better API would be to indicate the option addresses as struct offsets
in the main table and then separately give the base address of struct
where the results should be placed in (some parts of MPlayer code
already use something like that). Not really related to this patch
though.




More information about the MPlayer-dev-eng mailing list