2 * ll.c - various things of used for dealing with linked lists.
4 * Jonathan McDowell <noodles@earth.li>
6 * Copyright 2000-2002 Project Purple
15 struct ll *lladd(struct ll *curll, void *object)
19 if ((new = malloc(sizeof(struct ll))) == NULL) {
21 printf("Got NULL in lladd()\n");
31 struct ll *lldel(struct ll *curll, void *object,
32 int (*objectcmp) (const void *object1, const void *object2))
36 assert(objectcmp != NULL);
41 } else if (!(*objectcmp)(cur->object, object)) {
44 while (cur->next != NULL) {
45 if (!(*objectcmp)(cur->next->object, object)) {
46 cur->next = cur->next->next;
53 struct ll *llfind(struct ll *curll, void *object,
54 int (*objectcmp) (const void *object1, const void *object2))
59 while (cur != NULL && (*objectcmp)(cur->object, object)) {
65 unsigned long llsize(struct ll *curll)
67 unsigned long count = 0;
69 while (curll != NULL) {