feat: page_get implemented in page.c
This commit is contained in:
+9
-4
@@ -106,8 +106,13 @@ page_insert(Page * p, const void * data, size_t len)
|
||||
void *
|
||||
page_get(Page * p, uint16_t slot_id, size_t * out_len)
|
||||
{
|
||||
(void) p;
|
||||
(void) slot_id;
|
||||
(void) out_len;
|
||||
return NULL; /* noch nicht implementiert */
|
||||
PageHeader * h = header(p);
|
||||
|
||||
if (slot_id >= h->num_slots) return NULL; /* Slot existiert nicht */
|
||||
|
||||
Slot * s = (Slot *) (p->raw + sizeof(PageHeader)) + slot_id;
|
||||
|
||||
if (out_len) *out_len = s->length;
|
||||
|
||||
return p->raw + s->offset;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user