[FFmpeg-devel] [PATCH 1/4] lavu: add simple array implementation

Lukasz Marek lukasz.m.luki at gmail.com
Wed Mar 5 00:38:55 CET 2014


On 05.03.2014 00:26, Don Moir wrote:
>> From: "Michael Niedermayer" <michaelni at gmx.at>
>> To: "FFmpeg development discussions and patches"
>> <ffmpeg-devel at ffmpeg.org>
>> Sent: Tuesday, March 04, 2014 6:03 PM
>> Subject: Re: [FFmpeg-devel] [PATCH 1/4] lavu: add simple array
>> implementation
>
>>> >
>>> > av_dynarray_add_nofree function have similar functionality
>>> > as existing av_dynarray_add, but it doesn't deallocate memory
>>> > on fails.
>>>
>>> I am sorry, but I still do not like it very much. It fixes one of the
>>> flaws
>>> of av_dynarray_add(), but there are still others: you can not choose the
>>> element size (this is only in the 2 variant; this version is even
>>> worse: it
>>> assumes that sizeof(void *) == sizeof(intptr_t)),
>
>>> you can not choose the
>>> type for the size variable (at some places, it is convenient to be
>>> able to
>>> use size_t).
>
>> are you sure that you arent overdesigning this ?
>
> I think the original implentations are underdesigned (why you probably
> have 2) and the way Lukasz is trying to design it is the right way to
> go. I have been using a similiar method for many years and use it for a
> variety of things and always accomodates. Works from C but with C++ I
> also use templates which makes it even better with less explicit
> initialization and free and it's typed.
>
> I would rename Lukasz deleter to destructor though. Also within the
> struct, I provide a lock if you choose to use it. I use dynamic arrays a
> lot and sometimes with multi-thread usage. The way Lukasz is trying to
> design it probably has too much in it, but he is trying to accomodate
> the older implementations I believe. The other implementations should be
> marked as deprecated and re-routed to a new implementation in my opinion.

Thanks, at least one person likes mine solution. TBH I don't understand 
what is the problem with it. It can do to much? Or it is too easy to use?


-- 
Best Regards,
Lukasz Marek

I may be drunk, Miss, but in the morning I will be sober and you will 
still be ugly. - Winston Churchill


More information about the ffmpeg-devel mailing list