| 920 | // Table leaf cell: varint(payload_len) + varint(rowid) + payload |
| 921 | |
| 922 | static uint8_t *build_table_cell(int64_t rowid, const uint8_t *payload, int payload_len, |
| 923 | int *out_cell_len) { |
| 924 | int rl = varint_len(payload_len); |
| 925 | int kl = varint_len(rowid); |
| 926 | int total = rl + kl + payload_len; |
| 927 | uint8_t *cell = (uint8_t *)malloc(total); |
| 928 | if (!cell) { |
| 929 | return NULL; |
| 930 | } |
| 931 | int pos = 0; |
| 932 | pos += put_varint(cell + pos, payload_len); |
| 933 | pos += put_varint(cell + pos, rowid); |
| 934 | memcpy(cell + pos, payload, payload_len); |
| 935 | *out_cell_len = pos + payload_len; |
| 936 | return cell; |
| 937 | } |
| 938 | |
| 939 | // Build a table leaf cell with overflow: stores only the first local_len bytes of |
| 940 | // payload inline, followed by a 4-byte overflow page number. |
no test coverage detected