[pacman-dev] [PATCH] New alpm_list_join function + tail pointer

Nagy Gabor ngaba at bibl.u-szeged.hu
Wed Nov 21 08:05:43 EST 2007

> On Tue, Nov 20, 2007 at 03:11:22PM -0600, Aaron Griffin wrote:
> > On Nov 20, 2007 9:56 AM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
> > > I'd be happy if I shouldn't resubmit a s/tmp/last/
> > > change ;-) <- this is a trivial sed on my patch.
> > 
> > Please sed the patch and resubmit.
> > 
> I did it already:

Thanks a lot.
I found this comment _very_ useful:
/* The list pointers passed in should be considered invalid after calling this
function. */
This also shows that the tail pointer can confuse us.

I have an idea:
Since we can check in O(1) time whether a node is a "valid" head node or not
(node->prev && node->prev->next == NULL), we could modify alpm_list_last to
check this to choose between the new (fast) and the old (slow) algorithms.
And modify alpm_list.c to call alpm_list_last whenever last node is needed.
By doing this alpm_list.c becomes compatible with the old lists (head->prev ==
NULL) and we can use sublists (see also:

Bye, ngaba

SZTE Egyetemi Könyvtár - http://www.bibl.u-szeged.hu
This mail sent through IMP: http://horde.org/imp/

More information about the pacman-dev mailing list