Statistics
| Branch: | Revision:

root / mainbox / event.c @ 880dc54f

History | View | Annotate | Download (527 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
  event->next = NULL;
22
}
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
}