diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 17:25:54 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 17:25:54 -0400 |
| commit | d7e3d399d6c494ae0b37d8abae25e813aff4316f (patch) | |
| tree | 1b4fb2bfa54fc8703fda7e04464e71b9daa3c743 /compile.c | |
| parent | 43501f7bec61d8e8e4430c2226b86579d91a9450 (diff) | |
Fix up some edge cases with refcounting
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2134,7 +2134,7 @@ CORD compile(env_t *env, ast_t *ast) case TableType: { if (streq(f->field, "keys")) { return CORD_all("({ table_t *t = ", compile_to_pointer_depth(env, f->fielded, 1, false), ";\n" - "t->entries.data_refcount = 3;\n" + "ARRAY_INCREF(t->entries);\n" "t->entries; })"); } else if (streq(f->field, "values")) { auto table = Match(value_t, TableType); @@ -2143,7 +2143,7 @@ CORD compile(env_t *env, ast_t *ast) if (align > 1 && offset % align > 0) offset += align - (offset % align); return CORD_all("({ table_t *t = ", compile_to_pointer_depth(env, f->fielded, 1, false), ";\n" - "t->entries.data_refcount = 3;\n" + "ARRAY_INCREF(t->entries.data_refcount);\n" "(array_t){.data = t->entries.data + ", CORD_asprintf("%zu", offset), ",\n .length=t->entries.length,\n .stride=t->entries.stride,\n .data_refcount=3};})"); } else if (streq(f->field, "fallback")) { |
