aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-04 17:23:42 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-04 17:23:42 -0400
commit43501f7bec61d8e8e4430c2226b86579d91a9450 (patch)
tree5675d3a27546e9d068d3f232403060b986129348 /compile.c
parentfa0dee19e2259194f3d3d797f83917e92385df8f (diff)
Minor fix for array refcounting
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 1692d12b..8157a79a 100644
--- a/compile.c
+++ b/compile.c
@@ -2170,7 +2170,7 @@ CORD compile(env_t *env, ast_t *ast)
if (ptr->is_optional)
code_err(ast, "This pointer is potentially null, so it can't be safely dereferenced");
if (ptr->pointed->tag == ArrayType) {
- return CORD_all("({ array_t *arr = ", compile(env, indexing->indexed), "; arr->data_refcount = 3; *arr; })");
+ return CORD_all("({ array_t *arr = ", compile(env, indexing->indexed), "; ARRAY_INCREF(*arr); *arr; })");
} else if (ptr->pointed->tag == TableType) {
return CORD_all("({ table_t *t = ", compile(env, indexing->indexed), "; Table$mark_copy_on_write(t); *t; })");
} else {