CCB * ChainCelsAtTail(CCB *existingCels, CCB *newCels)
The most efficient way to iteratively build a list of cels is to use the return value from the prior call as the existingCels pointer for the current call. This eliminates long searches for the end of the ever-growing list of cels.
For example:
This function works properly with anti-aliased cels and similar constructs where a list of related cels makes up a single logical entity.
CCB *list = NULL;
CCB *tail = NULL;
CCB *cels;
do { cels = get_next_antialiased_cel();
tail = ChainCelsAtTail(tail, cels);
if (list == NULL) { list = cels; // remember head-of-list
pointer first time through. } }
while (cels != NULL);
ChainCelsAtHead