From: NeilBrown Date: Sat, 16 Oct 2021 05:27:41 +0000 (+1100) Subject: oceani: don't allocate init value for non-initialized fields. X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=809b04eb484b75d8c0e26ba12642ed34bc6b1fd7 oceani: don't allocate init value for non-initialized fields. 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 --- diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index 416084e..fedf05f 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -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