:pserver:anonymous@cvs.middle-man.sourceforge.net:/cvsroot/middle-man middleman
[middleman.git] / include / filter.h
1 #ifndef FILTER_H
2 #define FILTER_H
3
4 #define FILTER_LL_NEW(x) { \
5    if (x == NULL) \
6       x = xmalloc(sizeof(struct FILTER_LIST_LIST)); \
7    else { \
8       while (x->next != NULL) x = x->next; \
9       x->next = xmalloc(sizeof(struct FILTER_LIST_LIST)); \
10       x = x->next; \
11    } \
12    x->next = NULL; \
13    x->he = NULL; \
14    x->fe = NULL; \
15    x->host = NULL; \
16    x->file = NULL; \
17    x->template = NULL; \
18 };
19
20 #define FILTER_LL_INSERT(x, a, b, c) { \
21    if (a != NULL && x->he == NULL) { \
22       x->he = reg_compile(a, REGFLAGS | REG_NOSUB); \
23       x->host = xstrdup(a); \
24    } \
25    if (b != NULL && x->fe == NULL)  { \
26       x->fe = reg_compile(b, REGFLAGS | REG_NOSUB); \
27       x->file = xstrdup(b); \
28    } \
29    if (c != NULL && x->template == NULL) \
30       x->template = xstrdup(c); \
31 };
32
33 #endif                          /* FILTER_H */