]> git.ozlabs.org Git - ccan/blobdiff - ccan/tal/stack/stack.c
tal_stack
[ccan] / ccan / tal / stack / stack.c
diff --git a/ccan/tal/stack/stack.c b/ccan/tal/stack/stack.c
new file mode 100644 (file)
index 0000000..9b949e7
--- /dev/null
@@ -0,0 +1,24 @@
+/* Licensed under BSD-MIT - see LICENSE file for details */
+
+#include <ccan/tal/stack/stack.h>
+#include <assert.h>
+
+static tal_t *h = NULL;
+
+static void _free_frame(tal_t *o)
+{
+       h = tal_parent(o);
+}
+
+tal_t *tal_newframe_(const char *label)
+{
+       h = tal_alloc_(h, 0, false, label);
+       assert(h != NULL);
+       tal_add_destructor(h, _free_frame);
+       return h;
+}
+
+tal_t *tal_curframe(void)
+{
+       return h;
+}