8 struct ExitFunctionStorage {
9 void (*m_functionptr)(
void *);
12 void operator()()
const { m_functionptr(m_userdata); }
18 class RegistrationList {
25 ExitFunctionStorage m_funcs[BLOCK_SZ];
28 bool empty()
const {
return !m_sz; }
29 bool full()
const {
return m_sz == BLOCK_SZ; }
31 void push_front(
const ExitFunctionStorage &newfn) {
32 m_funcs[m_sz++] = newfn;
35 const ExitFunctionStorage &back()
const {
return m_funcs[m_sz - 1]; }
36 void pop_back() { m_sz--; }
39 struct FnNode :
public FnBlock {
40 FnNode(FnBlock *next) : m_next{next} {}
42 FnBlock *
const m_next =
nullptr;
49 FnBlock *m_list = &m_tail;
52 bool push_front(
const ExitFunctionStorage &new_exit);
58 #endif // not ATEXIT_IMPL_H