commit 715c783aec3e86d3c00aa93d4439113479acd393
parent 1a8979366fae2352f66712363b1d49f4bd3c9a10
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 24 Oct 2022 17:48:16 +0200
cc1: Don't use memset to initialize
This makes the code (even) more portable because it does
not depend of having null defined as 0.
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/cmd/cc/cc1/types.c b/src/cmd/cc/cc1/types.c
@@ -290,11 +290,12 @@ mktype(Type *tp, int op, TINT nelem, Type *pars[])
if (op == PTR && tp == voidtype)
return pvoidtype;
- memset(&type, 0, sizeof(type));
- type.type = tp;
- type.op = op;
- type.p.pars = pars;
- type.n.elem = nelem;
+ type = (Type) {
+ .type = tp,
+ .op = op,
+ .p.pars = pars,
+ .n.elem = nelem,
+ };
switch (op) {
case ARY: