+Missing <time.h> include
[middleman.git] / include / header.h
1 #ifndef HEADER_H
2 #define HEADER_H
3
4 #define HEADER_LIST_INSERT(x, a, b) { \
5    if (x == NULL) \
6       x = xmalloc(sizeof(struct HTTP_HEADER_LIST)); \
7    else { \
8       while (x->next != NULL) x = x->next; \
9       x->next = xmalloc(sizeof(struct HTTP_HEADER_LIST)); \
10       x = x->next; \
11    } \
12    x->next = NULL; \
13    x->type =xstrdup(a); \
14    x->value = xstrdup(b); \
15 };
16
17
18 #define HEADER_LL_NEW(x) { \
19    if (x == NULL) \
20       x = xmalloc(sizeof(struct HEADER_LIST_LIST)); \
21    else { \
22       while (x->next != NULL) x = x->next; \
23       x->next = xmalloc(sizeof(struct HEADER_LIST_LIST)); \
24       x = x->next; \
25    } \
26    x->te = NULL; \
27    x->ve = NULL; \
28    x->he = NULL; \
29    x->type = NULL; \
30    x->value = NULL; \
31    x->next = NULL; \
32 };
33
34 #define HEADER_LL_INSERT(x, a, b, c) { \
35    if (a != NULL && x->te == NULL) { \
36       x->te = reg_compile(a, REGFLAGS | REG_NOSUB); \
37       x->type = xstrdup(a); \
38    } \
39    if (b != NULL && x->ve == NULL) { \
40       x->ve = reg_compile(b, REGFLAGS | REG_NOSUB); \
41       x->value = xstrdup(b); \
42    } \
43    if (c != NULL && x->he == NULL)  { \
44       x->he = reg_compile(c, REGFLAGS | REG_NOSUB); \
45       x->host = xstrdup(c); \
46    } \
47 };
48
49 #endif                          /* HEADER_H */