From 795ffc5e62e8ba383575dbcd9943a580d4bd3358 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 15:50:21 +0200 Subject: formatting changes Manual format adjustments. Comment adjustments. Remove usage of the register keyword. --- include/genalloc.h | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'include/genalloc.h') diff --git a/include/genalloc.h b/include/genalloc.h index d27c6b1..351fb98 100644 --- a/include/genalloc.h +++ b/include/genalloc.h @@ -2,28 +2,31 @@ #define GENALLOC_H /* - * Revision 20210307, Erwin Hoffmann - * - -*/ + * Revision 20210307, Erwin Hoffmann + * - + */ #include -/* GEN_ALLOC demystified: - - GEN_ALLOC generates a list of self-defined types (structs) in an - allocated contiguous heap chunk while copying the content of the - entire field members or appending the existing field. - GEN_ALLOC types care of currently used and/or allocated bytes of field. +#include "alloc.h" + +/* + GEN_ALLOC demystified: -Macros: - GEN_ALLOC_ready (ta,type,field,len,a,i,n,x,base,ta_ready) - GEN_ALLOC_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) - GEN_ALLOC_append (ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) + GEN_ALLOC generates a list of self-defined types (structs) in an + allocated contiguous heap chunk while copying the content of the + entire field members or appending the existing field. + GEN_ALLOC types care of currently used and/or allocated bytes of field. + + Macros: + GEN_ALLOC_ready (ta,type,field,len,a,i,n,x,base,ta_ready) + GEN_ALLOC_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) + GEN_ALLOC_append (ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) 0. ta: 'type alloc' - typedef'ed struct name (aka ipalloc et al.) - 1. type: defined struct (used for size information) + 1. type: defined struct (used for size information) 2. field: declared public name of struct - 2. len: used length of string + 2. len: used length of string 4. a: allocated size 5. i: current allocated size for member x 6. n: bytes to allocate; in 'ready' mode: +size of one entry; @@ -32,7 +35,6 @@ Macros: 8. base: size of single entry 9. ta_ready/ta_readyplus (operation) 10. ta_append (operation) - */ /* file: gen_alloc.h */ @@ -46,11 +48,9 @@ Macros: /* 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; \ + int ta_ready(ta *x, unsigned int n) \ { \ - register unsigned int i; \ + unsigned int i; \ if (x->field) { \ i = x->a; \ if (n > i) { \ @@ -66,11 +66,9 @@ Macros: } #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; \ + int ta_rplus(ta *x, unsigned int n) \ { \ - register unsigned int i; \ + unsigned int i; \ if (x->field) { \ i = x->a; \ n += x->len; \ @@ -87,9 +85,7 @@ Macros: } #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; \ + int ta_append(ta *x, type *i) \ { \ if (!ta_rplus(x, 1)) return 0; \ x->field[x->len++] = *i; \ -- cgit v1.2.3