static void new_tristrip(polygon_node **tn, edge_node *edge, double x, double y) { polygon_node *temptn,*Stemp; #if 0 /* this part is the code i want to work */ MALLOC(temptn, sizeof(polygon_node), "tristrip node creation", polygon_node); (temptn)->next= NULL; (temptn)->v[LEFT]= NULL; (temptn)->v[RIGHT]= NULL; (temptn)->active= 1; add_vertex(&(temptn->v[LEFT]), x, y); edge->outp[ABOVE]= temptn; if(!(*tn)) tn=&temptn; else { Stemp=(*tn)->next; while((Stemp->next))Stemp=Stemp->next; Stemp->next=temptn; } return; #else /* this is the tail recursive code */ if (!(*tn)) { MALLOC(*tn, sizeof(polygon_node), "tristrip node creation", polygon_node); (*tn)->next= NULL; (*tn)->v[LEFT]= NULL; (*tn)->v[RIGHT]= NULL; (*tn)->active= 1; add_vertex(&((*tn)->v[LEFT]), x, y); edge->outp[ABOVE]= *tn; } else /* Head further down the list */ new_tristrip(&((*tn)->next), edge, x, y); #endif }
while (*tn) tn = &((*tn)->next); MALLOC (*tn, ...
tn
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)