X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftcon%2Ftcon.h;h=df3aac88b785a4acc241e125a9c377766a55272d;hb=HEAD;hp=247a7331c8b98aa52c7da44750b6db0c02c6c872;hpb=95573b36fd8130d5925f877a83b959c22aac1dfd;p=ccan diff --git a/ccan/tcon/tcon.h b/ccan/tcon/tcon.h index 247a7331..df3aac88 100644 --- a/ccan/tcon/tcon.h +++ b/ccan/tcon/tcon.h @@ -147,8 +147,7 @@ * It evaluates to @x so you can chain it. */ #define tcon_check_ptr(x, canary, expr) \ - (sizeof(&(x)->_tcon[0].canary == (expr)) ? (x) : (x)) - + (sizeof((expr) ? (expr) : &(x)->_tcon[0].canary) ? (x) : (x)) /** * tcon_type - the type within a container (or void *) @@ -321,6 +320,8 @@ * tcon_container_of() evaluates to a pointer to the container * structure. With sufficient compiler support, the pointer will be * correctly typed, and the type of @member_ptr will be verified. + * Note that const is discarded; a const @member_ptr still yields a + * non-const container (unless @canary is const). * * Returns NULL if @member_ptr is NULL. */