]> git.ozlabs.org Git - ccan/blob - ccan/tal/stack/stack.h
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / tal / stack / stack.h
1 /* Licensed under BSD-MIT - see LICENSE file for details */
2 #ifndef CCAN_TAL_STACK_H
3 #define CCAN_TAL_STACK_H
4
5 #include <ccan/tal/tal.h>
6
7 /**
8  * tal_newframe - allocate and return a new nested tal context
9  *
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.
13  *
14  * NOTE: this function is not threadsafe.
15  *
16  * Example:
17  *      tal_t *ctx = tal_newframe();
18  *      // ... do something with ctx ...
19  *      tal_free(ctx);
20  */
21 #define tal_newframe(void) tal_newframe_(TAL_LABEL(tal_stack, ""));
22
23 tal_t *tal_newframe_(const char *label);
24
25 /**
26  * tal_curframe - return the current 'tal_stack frame'
27  *
28  * Returns the context currently on top of the stack. The initial context
29  * (before any tal_newframe() call) is the tal 'NULL' context.
30  *
31  * NOTE: this function is not threadsafe.
32  */
33 tal_t *tal_curframe(void);
34 #endif /* CCAN_TAL_STACK_H */