debian/rules: Use `git' potty wrapper.
[qmail] / gen_allocdefs.h
CommitLineData
2117e02e
MW
1#ifndef GEN_ALLOC_DEFS_H
2#define GEN_ALLOC_DEFS_H
3
4#define GEN_ALLOC_ready(ta,type,field,len,a,i,n,x,base,ta_ready) \
5int ta_ready(x,n) register ta *x; register unsigned int n; \
6{ register unsigned int i; \
7 if (x->field) { \
8 i = x->a; \
9 if (n > i) { \
10 x->a = base + n + (n >> 3); \
11 if (alloc_re(&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
12 x->a = i; return 0; } \
13 return 1; } \
14 x->len = 0; \
15 return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); }
16
17#define GEN_ALLOC_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) \
18int ta_rplus(x,n) register ta *x; register unsigned int n; \
19{ register unsigned int i; \
20 if (x->field) { \
21 i = x->a; n += x->len; \
22 if (n > i) { \
23 x->a = base + n + (n >> 3); \
24 if (alloc_re(&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
25 x->a = i; return 0; } \
26 return 1; } \
27 x->len = 0; \
28 return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); }
29
30#define GEN_ALLOC_append(ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) \
31int ta_append(x,i) register ta *x; register type *i; \
32{ if (!ta_rplus(x,1)) return 0; x->field[x->len++] = *i; return 1; }
33
34#endif