#ifndef TEMPLATE_H #define TEMPLATE_H #define TEMPLATE_LIST_NEW(x) { \ if (x == NULL) \ x = xmalloc(sizeof(struct TEMPLATE_LIST)); \ else { \ while (x->next != NULL) x = x->next; \ x->next = xmalloc(sizeof(struct TEMPLATE_LIST)); \ x = x->next; \ } \ x->next = NULL; \ x->name = NULL; \ x->file = NULL; \ x->type = NULL; \ x->mime = NULL; \ }; #define TEMPLATE_LIST_INSERT(x, a, b, c, d) { \ if (a != NULL && x->name == NULL) \ x->name = xstrdup(a); \ if (b != NULL && x->file == NULL) \ x->file = xstrdup(b); \ if (c != NULL && x->type == NULL) \ x->type = xstrdup(c); \ if (d != NULL && x->mime == NULL) \ x->mime = xstrdup(d); \ }; #endif /* TEMPLATE_H */