--- ray/src/hd/sm_list.c 1998/08/19 17:45:24 3.1 +++ ray/src/hd/sm_list.c 1998/12/28 18:07:35 3.4 @@ -24,8 +24,6 @@ LIST { LIST *l; - - /* check free list for available edges */ if( free_lists ) { @@ -52,9 +50,6 @@ LIST *a,*b; { LIST * l; - if(!a) - return(b); - if(!b) return(a); @@ -67,6 +62,40 @@ LIST *a,*b; return(b); } +/* attaches list a at the end of list b */ +LIST +*add_data(l,d,end) +LIST *l; +int d; +LIST **end; + +{ + LIST *list,*lptr; + + list = new_list(); + SET_LIST_DATA(list,d); + + if(!l) + { + if(end) + *end = list; + return(list); + } + if(end) + lptr = *end; + else + { + lptr = l; + while(LIST_NEXT(lptr)) + lptr = LIST_NEXT(lptr); + } + LIST_NEXT(lptr) = list; + if(end) + *end = list; + + return(l); +} + /* Adds data to the end of a circular list. If set, "end" * is a pointer to the last element in the list */ @@ -118,6 +147,7 @@ LIST * l; { if(!l) return(NULL); + free_lists = append_list(free_lists,l); return(NULL); @@ -131,7 +161,7 @@ pop_list(l) LIST **l; { LIST *p; - void *d; + int d; if(!l) return(NULL);