[FFmpeg-devel] [PATCH 1/7] avutil/uuid: add utility library for manipulating UUIDs as specified in RFC 4122

Zane van Iperen zane at zanevaniperen.com
Wed Feb 23 08:53:44 EET 2022



On 23/2/22 00:21, James Almer wrote:
>> +int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
>> +{
>> +    return memcmp(uu1, uu2, AV_UUID_LEN) == 0;
>> +}
>> +
>> +void av_uuid_copy(AVUUID dest, const AVUUID src)
>> +{
>> +    memcpy(dest, src, AV_UUID_LEN);
>> +}
>> +
>> +void av_uuid_nil_set(AVUUID uu)
>> +{
>> +    memset(uu, 0, AV_UUID_LEN);
> 
> These three seem unnecessary. We don't need new public symbols for this when we can just state in the doxy that you can copy, compare or zero by assignment or zeroing or any such standard method.
> 

Personally, I think it makes the intent clearer, I'd be interested in other's opinions on this.

Alternatively, if AVUUID is changed to a struct we could remove av_uuid_copy() and av_uuid_nil_set():

     typedef struct AVUUID {
         uint8_t v[AV_UUID_LEN];
     } AVUUID;

     AVUUID a;
     AVUUID b = {0};
     a = b;




More information about the ffmpeg-devel mailing list