]> git.ozlabs.org Git - ccan/blobdiff - ccan/tal/tal.h
tal: don't defer-after-free if a destructor deletes itself.
[ccan] / ccan / tal / tal.h
index 54318e1fa116864ae5d00268b9d6c3144ba86eb3..8b7ffca5ea8125ef8ba36a623d989e8aad6fff33 100644 (file)
@@ -106,6 +106,9 @@ void *tal_free(const tal_t *p);
  * This returns true on success (and may move *@p), or false on failure.
  * On success, tal_count() of *@p will be @count.
  *
+ * Note: if *p is take(), it will still be take() upon return, even if it
+ * has been moved.
+ *
  * Example:
  *     tal_resize(&p, 100);
  */
@@ -161,7 +164,8 @@ void *tal_free(const tal_t *p);
  * @function: the function to call before it's freed.
  *
  * If @function has not been successfully added as a destructor, this returns
- * false.
+ * false.  Note that if we're inside the destructor call itself, this will
+ * return false.
  */
 #define tal_del_destructor(ptr, function)                                    \
        tal_del_destructor_((ptr), typesafe_cb(void, void *, (function), (ptr)))
@@ -192,7 +196,8 @@ void *tal_free(const tal_t *p);
  * @function: the function to call before it's freed.
  *
  * If @function has not been successfully added as a destructor, this returns
- * false.
+ * false.  Note that if we're inside the destructor call itself, this will
+ * return false.
  */
 #define tal_del_destructor(ptr, function)                                    \
        tal_del_destructor_((ptr), typesafe_cb(void, void *, (function), (ptr)))
@@ -227,7 +232,7 @@ enum tal_notify_type {
 
 /**
  * tal_add_notifier - add a callback function when this context changes.
- * @ptr: The tal allocated object.
+ * @ptr: The tal allocated object, or NULL.
  * @types: Bitwise OR of the types the callback is interested in.
  * @callback: the function to call.
  *