diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 17:02:29 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-04 17:02:29 -0400 |
| commit | fa0dee19e2259194f3d3d797f83917e92385df8f (patch) | |
| tree | 17592f6b87028d6488b1000e771d84fcfbf49b7d | |
| parent | aa218fe872892072fc3f8b5dcc24acd0c96f8346 (diff) | |
Add comment
| -rw-r--r-- | builtins/array.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/builtins/array.c b/builtins/array.c index fe1712e7..aa6929d5 100644 --- a/builtins/array.c +++ b/builtins/array.c @@ -602,6 +602,8 @@ public void Array$heapify(array_t *heap, closure_t comparison, int64_t padded_it if (heap->data_refcount != 0) Array$compact(heap, padded_item_size); + // It's necessary to bump the refcount because the user's comparison + // function could do stuff that modifies the heap's data. ARRAY_INCREF(*heap); int64_t i, n = heap->length; for (i = (n >> 1) - 1 ; i >= 0 ; i--) |
