[ccan] [PATCH 1/3] container_of: Add container_of_or_null()
rusty at rustcorp.com.au
Sat Sep 13 15:41:54 EST 2014
David Gibson <david at gibson.dropbear.id.au> writes:
> It's quite common to have a pointer which could be either a pointer to a
> structure member, or NULL. This needs special casing with container_of(),
> or it will convert NULL into something strange.
> This patch adds container_of_or_null(), which will return NULL if passed
> (an appropriately typed) NULL, or the containining structure as
> container_of() otherwise.
> Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
More information about the ccan