Re: [PATCH 04/16] Add embedded list interface (header only)
Marko Kreen <markokr@gmail.com>
From: Marko Kreen <markokr@gmail.com>
To: Andres Freund <andres@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Date: 2012-06-19T19:59:48Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Don't waste the last segment of each 4GB logical log file.
- dfda6ebaec67 9.3.0 cited
-
Stamp HEAD as 9.3devel.
- bed88fceac04 9.3.0 cited
-
Wake WALSender to reduce data loss at failover for async commit.
- 2c8a4e9be273 9.2.0 cited
-
Make the visibility map crash-safe.
- 503c7305a1e3 9.2.0 cited
On Wed, Jun 13, 2012 at 2:28 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> +/*
> + * removes a node from a list
> + * Attention: O(n)
> + */
> +static inline void ilist_s_remove(ilist_s_head *head,
> + ilist_s_node *node)
> +{
> + ilist_s_node *last = &head->head;
> + ilist_s_node *cur;
> +#ifndef NDEBUG
> + bool found = false;
> +#endif
> + while ((cur = last->next))
> + {
> + if (cur == node)
> + {
> + last->next = cur->next;
> +#ifndef NDEBUG
> + found = true;
> +#endif
> + break;
> + }
> + last = cur;
> + }
> + assert(found);
> +}
This looks weird.
In cyclic list removal is:
node->prev->next = node->next;
node->next->prev = node->prev;
And thats it.
--
marko