[vlc-devel] [RFC 3/3] vlc_arrays: append items in amortized O(1)

Romain Vimont rom1v at videolabs.io
Thu Jul 19 18:45:18 CEST 2018


On Thu, Jul 19, 2018 at 06:38:18PM +0200, Filip Roséen wrote:
> Hi Romain,
> 
> On 2018-07-19 17:57, Romain Vimont wrote:
> 
> > +VLC_USED VLC_MALLOC
> > +static inline void *vlc_realloc(void *ptr, size_t count, size_t size)
> > +{
> > +    return mul_overflow(count, size, &size) ? NULL : realloc(ptr, size);
> > +}
> 
> Why name this `vlc_realloc` when it is really an implementation of
> `reallocarray`? To me it makes little to no sense.
> 
> If you want an implementation that behaves and accepts the same
> arguments as `reallocarray`, I'd argue that you definitely should not
> name it after something both *standard*, and with a different
> signature.

I just named it from the existing name vlc_alloc().

But you're right.


More information about the vlc-devel mailing list