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

Romain Vimont rom1v at videolabs.io
Fri Jul 20 23:58:18 CEST 2018


On Fri, Jul 20, 2018 at 11:11:19PM +0200, Filip Roséen wrote:
> Hi Steve,
> 
> On 2018-07-20 13:54, Steve Lhomme wrote:
> > I disagree. VLC_Exxx and VLC_SUCCESS are for functions and even VLC_API functions that
> > return an int.
> 
> It was a note related to the entire patch, that happened to appear at
> a function where `-1` does not denote error. I understand that you
> might interpret what I wrote as if I am saying that `vlc_array_find`
> should use *error-codes*, but honestly I thought you'd know be better
> than that. `;-)`
> 
> Though, it was not entire clear from what I was writing so for that I
> apologize.
> 
> > Here we return an invalid array index which may have its own define but is not an error
> > code. But maybe I misread because the -1 is not even from this commit.
> 
> It was unfortunate that I wrote it under the function that is supposed
> to find the index of an item; I do agree that `vlc_array_find` not
> finding an element is not an error, and for what it is worth me and
> Romain spoke about this on *IRC*.
> 
> Best Regards,\
> Filip

Yes, I think we all agree. :)

I now use VLC_SUCCESS and VLC_ENOMEM in vlc_array_append() and
vlc_array_insert().

Thank you both.


More information about the vlc-devel mailing list