]> git.ozlabs.org Git - ccan/blobdiff - ccan/tcon/tcon.h
tcon: update and enhance documentation.
[ccan] / ccan / tcon / tcon.h
index 5b38c7193406fa1ccae181dbfde21849ace70601..866c2111e9c942f34c7f51f255f6ab2e3b552cca 100644 (file)
@@ -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
  *
  * 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.
  *
  * 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.
  *
  * Example:
  *     // Simply typesafe linked list.
  */
 #if HAVE_TYPEOF
 #define tcon_cast(x, canary, expr) ((__typeof__((x)->_tcon[0].canary))(expr))
  */
 #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))
 #else
 #define tcon_cast(x, canary, expr) ((void *)(expr))
+#define tcon_cast_ptr(x, canary, expr) ((void *)(expr))
 #endif
 
 #endif /* CCAN_TCON_H */
 #endif
 
 #endif /* CCAN_TCON_H */