diff options
author | Masahiko Sawada <msawada@postgresql.org> | 2024-04-03 10:27:43 +0900 |
---|---|---|
committer | Masahiko Sawada <msawada@postgresql.org> | 2024-04-03 10:27:43 +0900 |
commit | bcb14f4abca0c309f908b3f0cd64378785c99795 (patch) | |
tree | 2b756a9431bf00d9cb819c825609935e99fafbe1 /src/include/lib/binaryheap.h | |
parent | 2c91e13013414cf77bb8026a19a926e08f4e9e7a (diff) | |
download | postgresql-bcb14f4abca0c309f908b3f0cd64378785c99795.tar.gz postgresql-bcb14f4abca0c309f908b3f0cd64378785c99795.zip |
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
Diffstat (limited to 'src/include/lib/binaryheap.h')
-rw-r--r-- | src/include/lib/binaryheap.h | 4 |
1 files changed, 2 insertions, 2 deletions
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); |