Ensure leaves array has capacity for one more entry. Returns false on allocation failure.
| 1033 | // Ensure leaves array has capacity for one more entry. |
| 1034 | // Returns false on allocation failure. |
| 1035 | static bool pb_ensure_leaf_cap(PageBuilder *pb) { |
| 1036 | if (pb->leaf_count < pb->leaf_cap) { |
| 1037 | return true; |
| 1038 | } |
| 1039 | pb->leaf_cap = pb->leaf_cap == 0 ? INITIAL_LEAF_CAP : pb->leaf_cap * GROWTH_FACTOR; |
| 1040 | void *tmp = realloc(pb->leaves, (size_t)pb->leaf_cap * sizeof(PageRef)); |
| 1041 | if (!tmp) { |
| 1042 | free(pb->leaves); |
| 1043 | pb->leaves = NULL; |
| 1044 | return false; |
| 1045 | } |
| 1046 | pb->leaves = (PageRef *)tmp; |
| 1047 | return true; |
| 1048 | } |
| 1049 | |
| 1050 | // SQLite overflow thresholds for leaf table B-tree pages (PAGE_SIZE=65536, reserved=0): |
| 1051 | // usable = PAGE_SIZE = 65536 |
no outgoing calls
no test coverage detected