void List_setrest(struct List *pList, struct List *pRest);
The difficult part is the updating of the array pointed to by the
array element of the list pointed to by pList. There are
two main scenarios. For discussion purposes, let _pList and
_pRest be the (struct _List *) casted version of
pList and pRest, respectively.
In the first scenario, _pList->array != _pRest->array. In this
case, we need to copy elements from _pRest->array[_pRest->index] to
_pList->array[_pList->index+1], terminating only when we
reach the size of _pRest->array. Then, we need to resize
_pList->array according if its original size is larger.
In the second scenario, _pList->array == _pRest->array. This means
both _pList (the destination) and _pRest (the source)
utilize the same array. Copying a section of an array to another section
of the same array requires care, specially when the source range overlaps
with the destination range.
Regardless of the relationship of _pList->array and
_pRest->array, an array implementation involves a lot of
copy operations that consumes processing resources.