 |
fehQlibs 28
Qlibs
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
40#define GEN_ALLOC_typedef(ta,type,field,len,a) \
41 typedef struct ta { type *field; unsigned int len; unsigned int a; } ta;
45#define GEN_ALLOC_ready(ta,type,field,len,a,i,n,x,base,ta_ready) \
46int ta_ready(ta *x,unsigned int n) \
51 x->a = base + n + (n >> 3); \
52 if (alloc_re((void **)&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
53 x->a = i; return 0; } \
56 return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); }
58#define GEN_ALLOC_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) \
59int ta_rplus(ta *x,unsigned int n) \
62 i = x->a; n += x->len; \
64 x->a = base + n + (n >> 3); \
65 if (alloc_re((void **)&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
66 x->a = i; return 0; } \
69 return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); }
71#define GEN_ALLOC_append(ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) \
72int ta_append(ta *x,type *i) \
73{ if (!ta_rplus(x,1)) return 0; x->field[x->len++] = *i; return 1; }