X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Fparsergen.mdc;h=d30275e4e4d383a22905acd1e415c72d89fc56de;hp=6d291312547f0aad1ddadc57ee2affeb7e8b3802;hb=f8c00ecff941f5f86b4d54dd73cac3680684a11e;hpb=d67d447f79371573a26aee434133424a45caee93 diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index 6d29131..d30275e 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -2112,10 +2112,13 @@ automatically freed. This is equivalent to assigning `NULL` to the pointer. fputs("\n", f); for (i = 0; i < p->body_size; i++) { if (p->body[i]->struct_name.txt && - p->body[i]->isref && - used[i]) + used[i]) { // assume this has been copied out - fprintf(f, "\t\t*(void**)body[%d] = NULL;\n", i); + if (p->body[i]->isref) + fprintf(f, "\t\t*(void**)body[%d] = NULL;\n", i); + else + fprintf(f, "\t\tmemset(body[%d], 0, sizeof(struct %.*s));\n", i, p->body[i]->struct_name.len, p->body[i]->struct_name.txt); + } } free(used); }