| 807 | // Table leaf cell: varint(payload_len) + varint(rowid) + payload |
| 808 | |
| 809 | static uint8_t *build_table_cell(int64_t rowid, const uint8_t *payload, int payload_len, |
| 810 | int *out_cell_len) { |
| 811 | int rl = varint_len(payload_len); |
| 812 | int kl = varint_len(rowid); |
| 813 | int total = rl + kl + payload_len; |
| 814 | uint8_t *cell = (uint8_t *)malloc(total); |
| 815 | if (!cell) { |
| 816 | return NULL; |
| 817 | } |
| 818 | int pos = 0; |
| 819 | pos += put_varint(cell + pos, payload_len); |
| 820 | pos += put_varint(cell + pos, rowid); |
| 821 | memcpy(cell + pos, payload, payload_len); |
| 822 | *out_cell_len = pos + payload_len; |
| 823 | return cell; |
| 824 | } |
| 825 | |
| 826 | // Build a table leaf cell with overflow: stores only the first local_len bytes of |
| 827 | // payload inline, followed by a 4-byte overflow page number. |
no test coverage detected