Project

General

Profile

Statistics
| Branch: | Revision:

root / mainbox / event.c @ 75cef49f

History | View | Annotate | Download (505 Bytes)

1
#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
}
22

    
23
void event_q_process() {
24
  struct event_t *old;
25
  if (head && query_add_event(head) == 0) {
26
    old = head;
27
    head = head->next;
28
    event_free(old);
29
  }
30
}