]> git.ozlabs.org Git - ccan/commit
lstack: Allow a stack to be initialized from an existing top element
authorDavid Gibson <david@gibson.dropbear.id.au>
Sat, 13 Jun 2015 14:23:39 +0000 (00:23 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Sat, 13 Jun 2015 14:25:24 +0000 (00:25 +1000)
commitd448f12d07c5b65d5db29f207de3178490f8360d
tree4296d6d0cf06b616d20fe5327017cc0b26ff8cc6
parentc7a7fc0a1771394534cafaa7c30aa215631efc82
lstack: Allow a stack to be initialized from an existing top element

There are occasional cases where you might construct a valid stack, and
retain a direct pointer to the top element, but not the struct lstack
used to build it.

This patch adds a new lstack_init_from_top() macro to reconstruct a valid
struct lstack from the element pointer for cases like this.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
ccan/lstack/lstack.h