1 /* Licensed under BSD-MIT - see LICENSE file for details */
2 #ifndef CCAN_TAL_STACK_H
3 #define CCAN_TAL_STACK_H
5 #include <ccan/tal/tal.h>
8 * tal_newframe - allocate and return a new nested tal context
10 * Allocates and push a new tal context on top of the stack.
11 * The context must be freed using tal_free() which will also pop it
12 * off the stack, which will also free all its nested contexts, if any.
14 * NOTE: this function is not threadsafe.
17 * tal_t *ctx = tal_newframe();
18 * // ... do something with ctx ...
21 #define tal_newframe(void) tal_newframe_(TAL_LABEL(tal_stack, ""));
23 tal_t *tal_newframe_(const char *label);
26 * tal_curframe - return the current 'tal_stack frame'
28 * Returns the context currently on top of the stack. The initial context
29 * (before any tal_newframe() call) is the tal 'NULL' context.
31 * NOTE: this function is not threadsafe.
33 tal_t *tal_curframe(void);
34 #endif /* CCAN_TAL_STACK_H */