- // Copy the buffer, and then use the copy to build the list
- BufferTop* bufferTopCopy = buffertop_copy(bufferTop);
- List* bufferInList = _list_new(bufferTop->heap->array->dataSize);
- while (!buffertop_empty(bufferTopCopy))
- {
- void* topItem = buffertop_first_raw(bufferTopCopy)->item;
- // NOTE: list_insert_front(), to reverse (wrong) items order
- // ==> in the returned list, top element is at head.
- _list_insert_front(bufferInList, topItem);
- buffertop_pop(bufferTopCopy);
- }
- buffertop_destroy(bufferTopCopy);
- return bufferInList;
+ // Copy the buffer, and then use the copy to build the list
+ BufferTop* bufferTopCopy = buffertop_copy(bufferTop);
+ List* bufferInList = _list_new(bufferTop->heap->items->dataSize);
+ while (!buffertop_empty(bufferTopCopy))
+ {
+ void* topItem = _heap_top(bufferTopCopy->heap).item;
+ // NOTE: list_insert_front(), to reverse (wrong) items order
+ // ==> in the returned list, top element is at head.
+ _list_insert_front(bufferInList, topItem);
+ buffertop_pop(bufferTopCopy);
+ }
+ buffertop_destroy(bufferTopCopy);
+ return bufferInList;