]> ocean-lang.org Git - ocean/commitdiff
oceani: don't allocate init value for non-initialized fields.
authorNeilBrown <neil@brown.name>
Sat, 16 Oct 2021 05:27:41 +0000 (16:27 +1100)
committerNeilBrown <neil@brown.name>
Sat, 30 Oct 2021 22:18:36 +0000 (09:18 +1100)
Struct fields that aren't explicitly initialised must be initialized to
a 'null' value.  This can happen at interp-time.  There is no need to
allocate a null value when parsing.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/oceani.mdc

index 416084e26512c613ec287d70feaa85a8ad65e0e6..fedf05f8259c3b7a4e7ec2b77e17ac0d139867ab 100644 (file)
@@ -1978,7 +1978,8 @@ function will be needed.
                        $0 = calloc(1, sizeof(struct fieldlist));
                        $0->f.name = $1.txt;
                        $0->f.type = $<3;
-                       $0->f.init = val_alloc($0->f.type, NULL);
+                       if ($0->f.type->prepare_type)
+                               $0->f.type->prepare_type($0->f.type);
                }$
 
 ###### forward decls