ucx/list.c

changeset 23
ccc294fafb9b
parent 22
76cdd8209f1f
child 24
e04822101291
equal deleted inserted replaced
22:76cdd8209f1f 23:ccc294fafb9b
115 n = e->next; 115 n = e->next;
116 fnc(e, data); 116 fnc(e, data);
117 e = n; 117 e = n;
118 } 118 }
119 } 119 }
120
121 /* list specific functions */
122 UcxList *ucx_list_remove(UcxList *l, UcxList *e) {
123 if (e == l) {
124 l = e->next;
125 free(e);
126 } else {
127 UcxList *f = l;
128 while (f->next != NULL && f->next != e) {
129 f = f->next;
130 }
131 /* perform remove iff this element is found in this list */
132 if (f->next == e) {
133 f->next = e->next;
134 free(e);
135 }
136 }
137 return l;
138 }

mercurial