summaryrefslogtreecommitdiff
path: root/src/Main.cc
blob: eb5e5894993849631f6c6f705a07a8cf2ce1397f (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
25
26
27
28
29
30
31
32
33
34
#include "Main.h"

Balau::AtStart * Balau::AtStart::s_head = 0;
Balau::AtExit * Balau::AtExit::s_head = 0;

Balau::AtStart::AtStart(int priority) : m_priority(priority) {
    if (priority < 0)
        return;

    AtStart ** ptr = &s_head;

    m_next = 0;

    for (ptr = &s_head; *ptr && (priority > (*ptr)->m_priority); ptr = &((*ptr)->m_next));

    m_next = *ptr;
    *ptr = this;
}

Balau::AtExit::AtExit(int priority) : m_priority(priority) {
    if (priority < 0)
        return;

    AtExit ** ptr = &s_head;

    m_next = 0;

    for (ptr = &s_head; *ptr && (priority > (*ptr)->m_priority); ptr = &((*ptr)->m_next));

    m_next = *ptr;
    *ptr = this;
}

Balau::Main * Balau::Main::s_application = NULL;