[vlc-devel] [PATCH 1/2] Add a file extension dynamic manager to libvlc.

ßєŋ sashipa.ben at gmail.com
Sun Mar 1 16:49:56 CET 2009


On Sun, Mar 1, 2009 at 3:30 PM, Rémi Denis-Courmont <rem at videolan.org> wrote:
>        Hello,
>
> Le jeudi 26 février 2009 11:23:14 Benjamin Gerard, vous avez écrit :
>> +/* MUST BE LOCKED -- duplicate a pool */
>> +static fileext_pool_t * pool_dup( fileext_pool_t * pool )
>> +{
>> +   fileext_pool_t * dup = pool_create( pool->i_cnt );
>> +
>> +   if( dup )
>> +   {
>> +      dup->i_cnt = pool->i_cnt;
>> +      memmove( dup->fileext, pool->fileext, dup->i_cnt * sizeof(fileext_t)
>> );
>> +   }
>> +   return dup;
>
> memmove() works, but memcpy() is faster and more idiomatic here.

Right.

> But anyway... mutexes cannot be copied, so this seems incorrect, but I do not
> know why you have the duplication function.
>

No mutex is copied. The mutex is for a whole pool and it is properly
initialized by the pool_create() function.
The duplicate function is for convenience only. May be someone someday
will find it useful. Unless you really want to quiet things really
minimal I don't see any harm in keeping it.


-- 
B.



More information about the vlc-devel mailing list