list: list_swap to exchange elements
authorEric Wong <normalperson@yhbt.net>
Fri, 24 Oct 2014 22:02:29 +0000 (22:02 +0000)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 30 Mar 2015 06:46:33 +0000 (17:16 +1030)
commit3d74240c155b68ae0d59a5942048aa1db3e29b01
tree1bca7cc83d75d82b689f734ada7469d083d89cfb
parente4046df7898c233437c3ac9857371d6b1da97512
list: list_swap to exchange elements

This allows deleting and re-inserting an element in place
of the deleted element without branching.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/list/list.h
ccan/list/test/run.c