| 308 | } |
| 309 | |
| 310 | static void sqlv_push(sqlv_ranges_t *r, TSRange range) { |
| 311 | if (r->failed) { |
| 312 | return; |
| 313 | } |
| 314 | if (r->count == r->cap) { |
| 315 | uint32_t cap = r->cap ? r->cap * SQLV_GROWTH : SQLV_INITIAL_CAP; |
| 316 | TSRange *grown = |
| 317 | (TSRange *)cbm_realloc(CBM_MEM_CLASS_EXTRACT, r->items, (size_t)cap * sizeof(TSRange)); |
| 318 | if (!grown) { |
| 319 | r->failed = true; |
| 320 | return; |
| 321 | } |
| 322 | r->items = grown; |
| 323 | r->cap = cap; |
| 324 | } |
| 325 | r->items[r->count++] = range; |
| 326 | } |
| 327 | |
| 328 | /* The cursor sits just past VALUES. Keep the first tuple; exclude each later |
| 329 | * literal-only tuple together with the comma before it. Runs of excluded tuples |
no test coverage detected