[Ffmpeg-devel] [PATCH] Redundant memset

Rich Felker dalias
Sat Sep 9 05:50:18 CEST 2006


On Sat, Sep 09, 2006 at 12:27:52AM +0200, Michael Niedermayer wrote:
> Hi
> 
> On Fri, Sep 08, 2006 at 10:35:06AM -0400, Rich Felker wrote:
> > On Fri, Sep 08, 2006 at 10:32:27AM +0200, Michael Niedermayer wrote:
> > > Hi
> > > 
> > > On Fri, Sep 08, 2006 at 10:11:22AM +0200, Panagiotis Issaris wrote:
> > > > Hi,
> > > > 
> > > > The attached patch removes a redundant memset from libavformat. The memory is
> > > > cleared with memset although it had been previously allocated with av_mallocz
> > > > and thus was already cleared. The function avformat_get_context_defaults()
> > > > is only used from av_alloc_format_context().
> > > 
> > > if so then id say add a static under
> > > #if LIBAVCODEC_VERSION_INT > ...
> > > so it dissapears when we next do a compatibility breaking change
> > 
> > Isn't it supposed to be possible for the caller to setup the struct
> > without asking lavf to allocate it?
> 
> no, for what would that be usefull?

I was thinking it would be useful if the caller doesn't want to use
malloc but instead allocate the struct static or on the stack.

> also the struct size might differ between
> lavf versions not that that would make it impossible to do it outside but

This only matters if you're using shared libraries.

Rich





More information about the ffmpeg-devel mailing list