[FFmpeg-devel] [PATCH] Bunch of accumulated patches...

Rich Felker dalias
Wed Jan 16 03:59:52 CET 2008


On Wed, Jan 16, 2008 at 02:24:31AM +0100, Michael Niedermayer wrote:
> On Tue, Jan 15, 2008 at 10:27:06PM +0100, Sigbj?rn Skj?ret wrote:
> [...]
> > >>> If you have a suggestion which would be cleaner while retaining simple code,
> > >>> high speed and low memory requirements, just say it ...
> > >> Well, it's obviously not possible to avoid malloc&co without adding callbacks,
> > >> but that would rule out stuffing it to stack...
> > > Well, you might be unaware but the current tree code does avoid malloc&co
> > > without callbacks. Only the destroy function is missing but its not needed
> > > in the normal *malloc() free usecase. And with av_malloc() the current (old)
> > > destroy works fine.
> > 
> > I did actually notice, the only problem is that it uses av_tree_node_size to
> > accomplish this, which kind of brings us full circle .. having the caller
> > allocating something your code is solely responsible for manipulating is a bad
> > idea on several levels.
> 
> And that gets us back to my question, if you know a equivalently effective
> and simple alternative.
> If not the design is optimal (compared to all alternatives proposed) and its
> your philosophical view which seems faulty.
> 
> And besides, yes i disagree, theres nothing wrong with the caller doing
> allocation of needed (possibly temporary) space.

I agree with Michael absolutely here. Whenever possible the caller
should allocate. It makes the library more flexible and allows for
more efficient applications.

Rich




More information about the ffmpeg-devel mailing list