- if (l->head == i) l->head = i->next;
- if (l->end == i) l->end = i->next;
- if (p) p->next = i->next;
- free(i);
- l->current = NULL;
- return;
+ if (i->data == data)
+ {
+ if (l->head == i) l->head = i->next;
+ if (l->end == i) l->end = p;
+ if (p) p->next = i->next;
+ free(i);
+ l->current = NULL;
+ return;
+ }
+ p = i;
+ i = i->next;