Quoting Nicolas George (2020-07-01 18:47:15)
> Anton Khirnov (12020-07-01):
> > instead of
> > #define AVRC_TYPE AVBuffer
> > #define AVRC_PREFIX prefix
> > #define AVRC_FIELD refcount
> > you'd have
> > av_refcount_init(&buf->refcount, buf, buffer_free);
> > Does not look more annoying to me, to the contrary macro templates
> > require more effort to understand or debug.
> 
> The annoying part is to have to dereference buf->opaque each time we
> need to use it. It clutters all the code that use a structure. It is
> completely unacceptable to me.

You do not dereference buf->opaque. You pass it to the free callback
when the refcount reaches zero, that is the only way it should ever be
used.

> 
> > Why? I do not see how an extra pointer dereference could possibly matter 
> > here.
> 
> It does not matter much, but in tights loops it can.

If you constantly alloc and free objects in tight loops then you have
way bigger problems than a single pointer dereference. This is really a
red herring.

Beyond that, I suppose this is a personal preference difference. Some
more opinions from other people would be welcome.

-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to