[pacman-dev] [GIT] The official pacman repository branch, master, updated. v3.0.0-531-gd0d5848

Nagy Gabor ngaba at bibl.u-szeged.hu
Fri Nov 9 17:24:44 EST 2007


> I'm really confused by this email, so let me see if I understood this
> properly. What you mean to say is as follows:
> 
> On Nov 9, 2007 5:13 AM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
> > No. I meant that removing the first node with alpm_list_remove_node
> > will create a "->next circle" now, because node->prev always !=
> > NULL.
> 
> A "->next circle" is what? A circular list in the forward/next
> direction? "removing the first node" meaning the first node in the
> list (head node)? the first node found?
> 
> I'd like to fix this but I really have no idea what you mean - I'm not
> trying to be an ass, I just don't get it.
> 
> 
> > 1. /* break our reverse circular list */ will corrupt the input
> > list without restoring
> 
> To be clear, line 459 is what you mean? Is this what you intended to
> say: Setting the head node's ->prev point to NULL corrupts the passed
> in list ?
> 
Yes, I mean line 349 <- I assume a typo here ;-)
But I suggest simply remove that function, as Dan said.

I explain why (this will be boring):
I simply cannot understand how this function should be called:
I imagine something like this:
for (i=list; i; i=i->next) {
	if(foo(i)) alpm_list_remove_node(i);
}
But there are some problems here:
1. If you remove (detach) the first node, list will point to a corrupt
1-element (the old 1st element) list, and other nodes will be lost. So
you have to keep this in mind in the _caller_ function.
2. After Aaron tail-patch, you must reset tail-pointer if you remove
the last element (like in alpm_list_remove); which is not a nice game
again, since alpm_list_remove_node doesn't know too much about the
"whole" list.

Bye, ngaba




More information about the pacman-dev mailing list