root / mainbox / event.c @ 15928a3d
History | View | Annotate | Download (527 Bytes)
1 | 75cef49f | Tom Mullins | #include "event.h" |
---|---|---|---|
2 | #include "query.h" |
||
3 | #include <stdlib.h> |
||
4 | |||
5 | struct event_t *head, *tail;
|
||
6 | |||
7 | struct event_t *event_alloc() {
|
||
8 | return malloc(sizeof(struct event_t)); |
||
9 | } |
||
10 | |||
11 | void event_free(struct event_t *event) { |
||
12 | free(event); |
||
13 | } |
||
14 | |||
15 | void event_q_push(struct event_t *event) { |
||
16 | if (tail)
|
||
17 | tail->next = event; |
||
18 | else
|
||
19 | head = event; |
||
20 | tail = event; |
||
21 | 880dc54f | Tom Mullins | event->next = NULL;
|
22 | 75cef49f | Tom Mullins | } |
23 | |||
24 | void event_q_process() {
|
||
25 | struct event_t *old;
|
||
26 | if (head && query_add_event(head) == 0) { |
||
27 | old = head; |
||
28 | head = head->next; |
||
29 | event_free(old); |
||
30 | } |
||
31 | } |