The linkedListItemInsert api accepts nodeValuePointer, and saves it.
A better api would be to simply return pointer to pointer and let the caller to do the actual write when he see fits
|
export function linkedListItemInsert( |
|
carrier: GlobalCarrier, |
|
linkedListPointer: number, |
|
nodeValuePointer: number |
|
) { |
|
const { allocator, heap } = carrier; |
|
const newEndMarker = allocator.calloc(linkedListItem_size); |
|
|
|
linkedListItem_set_all(heap, newEndMarker, 0, 0); |
|
const wasEndMarker = linkedList_END_POINTER_get(heap, linkedListPointer); |
|
linkedList_END_POINTER_set(heap, linkedListPointer, newEndMarker); |
|
|
|
linkedListItem_set_all(heap, wasEndMarker, newEndMarker, nodeValuePointer); |
|
|
|
return wasEndMarker; |
|
} |
The
linkedListItemInsertapi accepts nodeValuePointer, and saves it.A better api would be to simply return pointer to pointer and let the caller to do the actual write when he see fits
objectbuffer/src/internal/linkedList/linkedList.ts
Lines 45 to 60 in da30950