Re: [notmuch] notmuch_threads_back and notmuch_messages_back

Subject: Re: [notmuch] notmuch_threads_back and notmuch_messages_back

Date: Sun, 6 Dec 2009 18:34:37 +0100

To: Carl Worth


From: Ruben Pollan

On 19:57, Fri 27 Nov 09, Carl Worth wrote:
> (I'd like a verb that pairs better
> with "advance" than the non-verb "back"---any suggestions)?

What about regress?
I'm not a native English speaker, so maybe someone can suggest something better.

> So those won't need any new code. The one case that will need new code
> is that for notmuch_message_get_replies and
> notmuch_message_get_toplevel_messages the messages iterator is currently
> built on a singly-linked list. Making it doubly linked would obviously
> not be hard though.

I'm trying to convert it to a doubly linked list, but I'm not sure if I
understand well how they work.

I don't see how _notmuch_message_list_append works. It says "node can of course
point to an arbitrarily long list of nodes", but the code is:

_notmuch_message_list_append (notmuch_message_list_t *list,                
                  notmuch_message_node_t *node)                            
    *(list->tail) = node;
    list->tail = &node->next;

Should not be something like:

_notmuch_message_list_append (notmuch_message_list_t *list,                
                  notmuch_message_node_t *node)                            
    notmuch_message_node_t *next_node;

    *(list->tail) = node;
	for (next_node = node->next; next_node->next != NULL;
	     next_node = next_node->next);
	list->tail = &next_node->next;

Do I miss something? Or the function is just designed to work on a single node
not a list of them?

Rubén Pollán  |
         No vamos a reivindicar nada,
            no vamos a pedir nada.
            Tomaremos, okuparemos.
signature.asc (application/pgp-signature)