summaryrefslogtreecommitdiff
path: root/ccan/tal/stack/stack.c
blob: 9b949e79f2a92b6ef9dca014a58f55b9aa91b8a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}