From bcb14f4abca0c309f908b3f0cd64378785c99795 Mon Sep 17 00:00:00 2001 From: Masahiko Sawada Date: Wed, 3 Apr 2024 10:27:43 +0900 Subject: Make binaryheap enlargeable. The node array space of the binaryheap is doubled when there is no available space. Reviewed-by: Vignesh C, Peter Smith, Hayato Kuroda, Ajin Cherian, Tomas Vondra, Shubham Khanna Discussion: https://postgr.es/m/CAD21AoDffo37RC-eUuyHJKVEr017V2YYDLyn1xF_00ofptWbkg%40mail.gmail.com --- src/include/lib/binaryheap.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/include/lib/binaryheap.h') diff --git a/src/include/lib/binaryheap.h b/src/include/lib/binaryheap.h index 19025c08ef1..9f6efb06e3a 100644 --- a/src/include/lib/binaryheap.h +++ b/src/include/lib/binaryheap.h @@ -46,10 +46,10 @@ typedef struct binaryheap bool bh_has_heap_property; /* debugging cross-check */ binaryheap_comparator bh_compare; void *bh_arg; - bh_node_type bh_nodes[FLEXIBLE_ARRAY_MEMBER]; + bh_node_type *bh_nodes; } binaryheap; -extern binaryheap *binaryheap_allocate(int capacity, +extern binaryheap *binaryheap_allocate(int num_nodes, binaryheap_comparator compare, void *arg); extern void binaryheap_reset(binaryheap *heap); -- cgit v1.2.3