Lines Matching defs:list
41 /* Iterate over a list of elements; returns ptr to a new element
42 * in list upon every call and NULL when no more are left.
50 * The cursor must be initialized to point to the list to iterate over.
54 slist_iterate(SList *list, SList **cursor)
56 slist_iterate(list, cursor)
57 SList *list, **cursor;
62 if ( list==NULL || cursor == NULL || *cursor==NULL ) return NULL;
63 if ( list== *cursor ) { *cursor = (*cursor)->next; }
70 * add an element to a list.
72 * Any non-empty list has a sentinel node whose 'elem' pointer is really
73 * a pointer to the last element. (i.e. length(list) = #elemIn(list)+1).
74 * Elements are appended to the list.
78 slist_add( SList **list, void *e )
80 slist_add( list, e )
81 SList **list;
86 require(e!=NULL, "slist_add: attempting to add NULL list element");
89 require(p!=NULL, "slist_add: cannot alloc new list node");
91 if ( *list == NULL )
95 *list=sentinel;
99 else /* find end of list */
101 tail = (SList *) (*list)->elem; /* get tail pointer */
103 (*list)->elem = (char *) p; /* reset tail */
109 slist_free(SList *list)
111 slist_free(list)
112 SList *list;
117 if ( list==NULL ) return; /* empty list */
118 for (p = list->next; p!=NULL; p=q)