X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftcon%2Ftcon.h;h=866c2111e9c942f34c7f51f255f6ab2e3b552cca;hp=5b38c7193406fa1ccae181dbfde21849ace70601;hb=cafea330f28cd9fc5588ea547889770ca009185a;hpb=5c451bbbed80e3bcb1f6be4301026ece01ab1309 diff --git a/ccan/tcon/tcon.h b/ccan/tcon/tcon.h index 5b38c719..866c2111 100644 --- a/ccan/tcon/tcon.h +++ b/ccan/tcon/tcon.h @@ -9,11 +9,11 @@ * * This declares a _tcon member for a structure. It should be the * last element in your structure; with sufficient compiler support it - * will not use any actual storage. tcon_to_raw() will compare + * will not use any actual storage. tcon_check() will compare * expressions with one of these "type canaries" to cause warnings if * the container is misused. * - * A type of "void *" will allow tcon_to_raw() to pass on any (pointer) type. + * A type of "void *" will allow tcon_check() to pass on any (pointer) type. * * Example: * // Simply typesafe linked list. @@ -74,8 +74,10 @@ */ #if HAVE_TYPEOF #define tcon_cast(x, canary, expr) ((__typeof__((x)->_tcon[0].canary))(expr)) +#define tcon_cast_ptr(x, canary, expr) ((__typeof__(&(x)->_tcon[0].canary))(expr)) #else #define tcon_cast(x, canary, expr) ((void *)(expr)) +#define tcon_cast_ptr(x, canary, expr) ((void *)(expr)) #endif #endif /* CCAN_TCON_H */