[pacman-dev] alpm_list: missing quick access to last element

Aaron Griffin aaronmgriffin at gmail.com
Sun Mar 4 23:15:44 EST 2007


On 3/4/07, Jürgen Hötzel <juergen at hoetzel.info> wrote:
> due the missing "last element hint" which speeded up the add operation
> before aaron introduced the public alpm_list type two months ago. I
> consider adding the "last element" member again. Any objections?

Actually, that's probably a bad idea.  It's almost trivial to convert
the list to a circular one.  Then alpm_list_last(foo) would just be
foo->prev;

There should never be a case when this would cause a problem (i.e.
some sort of "scan backward until ->prev is null" function would only
be useful in the case of bad design).


More information about the pacman-dev mailing list