| 825 | // Table leaf cell: varint(payload_len) + varint(rowid) + payload |
| 826 | |
| 827 | static uint8_t *build_table_cell(int64_t rowid, const uint8_t *payload, int payload_len, |
| 828 | int *out_cell_len) { |
| 829 | int rl = varint_len(payload_len); |
| 830 | int kl = varint_len(rowid); |
| 831 | int total = rl + kl + payload_len; |
| 832 | uint8_t *cell = (uint8_t *)malloc(total); |
| 833 | if (!cell) { |
| 834 | return NULL; |
| 835 | } |
| 836 | int pos = 0; |
| 837 | pos += put_varint(cell + pos, payload_len); |
| 838 | pos += put_varint(cell + pos, rowid); |
| 839 | memcpy(cell + pos, payload, payload_len); |
| 840 | *out_cell_len = pos + payload_len; |
| 841 | return cell; |
| 842 | } |
| 843 | |
| 844 | // Build a table leaf cell with overflow: stores only the first local_len bytes of |
| 845 | // payload inline, followed by a 4-byte overflow page number. |
no test coverage detected