[pacman-dev] [PATCH] Fix alpm_list_add_sorted

Nagy Gabor ngaba at bibl.u-szeged.hu
Tue Nov 13 12:31:08 EST 2007

> On Nov 13, 2007 11:01 AM, Nagy Gabor <ngaba at bibl.u-szeged.hu> wrote:
> > Hi!
> > Patch attached.
> Could you explain exactly what this is fixing? The subject just says
> "fix" - is this something I missed with the tail pointer changes?
See the patch description:
"The old code forgot about the case, when we insert the new node before the old
list (set tail needed)"
In other words, the old code just set add->prev = prev; in the beginning, but
this breaks the (prev == NULL) case (without any further thinking: prev cannot
be NULL now.)

> Other than that, I think we're good. It looks... ok to me.
> And, for the record, I have to point out that I don't like comments
> like this, heh:
> +		/* set add->next */
>  		add->next = next;
Feel free to remove it. This was helpful to me; this is a comment of a _block_,
it is something like /* step 1. */; because now a simple 'set add->next' can
lead to complicated case-checking.

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