summaryrefslogtreecommitdiff
path: root/include/genalloc.h
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 14:41:53 +0200
commit5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (patch)
tree684758441f5b431d0008253243034b6a4a29417c /include/genalloc.h
parent249866e3d1e11dc72eaa1305f4bb479ded92ef38 (diff)
initial clang-format
Diffstat (limited to 'include/genalloc.h')
-rw-r--r--include/genalloc.h83
1 files changed, 54 insertions, 29 deletions
diff --git a/include/genalloc.h b/include/genalloc.h
index ee489af..d27c6b1 100644
--- a/include/genalloc.h
+++ b/include/genalloc.h
@@ -36,39 +36,64 @@ Macros:
*/
/* file: gen_alloc.h */
-#define GEN_ALLOC_typedef(ta,type,field,len,a) \
- typedef struct ta { type *field; unsigned int len; unsigned int a; } ta;
+#define GEN_ALLOC_typedef(ta, type, field, len, a) \
+ typedef struct ta { \
+ type *field; \
+ unsigned int len; \
+ unsigned int a; \
+ } ta;
/* file: gen_allocdefs.h (deprecated) */
// used in: ipalloc, prioq, qmail-remote, qmail-inject, token822
-#define GEN_ALLOC_ready(ta,type,field,len,a,i,n,x,base,ta_ready) \
-int ta_ready(x,n) register ta *x; register unsigned int n; \
-{ register unsigned int i; \
- if (x->field) { \
- i = x->a; \
- if (n > i) { \
- x->a = base + n + (n >> 3); \
- if (alloc_re(&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
- x->a = i; return 0; } \
- return 1; } \
- x->len = 0; \
- return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); }
+#define GEN_ALLOC_ready(ta, type, field, len, a, i, n, x, base, ta_ready) \
+ int ta_ready(x, n) \
+ register ta *x; \
+ register unsigned int n; \
+ { \
+ register unsigned int i; \
+ if (x->field) { \
+ i = x->a; \
+ if (n > i) { \
+ x->a = base + n + (n >> 3); \
+ if (alloc_re(&x->field, i * sizeof(type), x->a * sizeof(type))) return 1; \
+ x->a = i; \
+ return 0; \
+ } \
+ return 1; \
+ } \
+ x->len = 0; \
+ return !!(x->field = (type *)alloc((x->a = n) * sizeof(type))); \
+ }
-#define GEN_ALLOC_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) \
-int ta_rplus(x,n) register ta *x; register unsigned int n; \
-{ register unsigned int i; \
- if (x->field) { \
- i = x->a; n += x->len; \
- if (n > i) { \
- x->a = base + n + (n >> 3); \
- if (alloc_re(&x->field,i * sizeof(type),x->a * sizeof(type))) return 1; \
- x->a = i; return 0; } \
- return 1; } \
- x->len = 0; \
- return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); }
+#define GEN_ALLOC_readyplus(ta, type, field, len, a, i, n, x, base, ta_rplus) \
+ int ta_rplus(x, n) \
+ register ta *x; \
+ register unsigned int n; \
+ { \
+ register unsigned int i; \
+ if (x->field) { \
+ i = x->a; \
+ n += x->len; \
+ if (n > i) { \
+ x->a = base + n + (n >> 3); \
+ if (alloc_re(&x->field, i * sizeof(type), x->a * sizeof(type))) return 1; \
+ x->a = i; \
+ return 0; \
+ } \
+ return 1; \
+ } \
+ x->len = 0; \
+ return !!(x->field = (type *)alloc((x->a = n) * sizeof(type))); \
+ }
-#define GEN_ALLOC_append(ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) \
-int ta_append(x,i) register ta *x; register type *i; \
-{ if (!ta_rplus(x,1)) return 0; x->field[x->len++] = *i; return 1; }
+#define GEN_ALLOC_append(ta, type, field, len, a, i, n, x, base, ta_rplus, ta_append) \
+ int ta_append(x, i) \
+ register ta *x; \
+ register type *i; \
+ { \
+ if (!ta_rplus(x, 1)) return 0; \
+ x->field[x->len++] = *i; \
+ return 1; \
+ }
#endif