[Ffmpeg-devel] [PATCH] Redundant memset

Michael Niedermayer michaelni
Fri Sep 8 10:32:27 CEST 2006


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


> 
>  utils.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> One problem with the first patch is that the semantic of avformat_get_context_defaults()
> is possibly altered. Namely, if someone wants to set a beforehand allocated AVFormatContext
> to the default values and memsetting the struct is considered as being default. So, the
> second patch removes the redundancy in a different way, by changing the av_mallocz() to
> av_malloc() and leaving the memset() untouched.

iam fine with the second patch

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is




More information about the ffmpeg-devel mailing list