(*last)->next = *next;
else
(*first) = *next;
+ (*next)->prev = *last;
(*last) = (*next);
(*next) = (*next)->next;
}
(*last)->next = *next;
else
(*first) = *next;
+ (*next)->prev = *last;
(*last) = (*next);
(*next) = (*next)->next;
}
/* Verify events and todos*/
#ifdef DEBUG_CALS
- for (event_t *cur = EVENTS; cur; cur = cur->next)
+ for (event_t *cur = EVENTS; cur; cur = cur->next) {
if (!cur->cal)
error("Missing cal in event '%s'", cur->name);
- for (todo_t *cur = TODOS; cur; cur = cur->next)
+ if ((cur->next && cur->next->prev != cur) ||
+ (cur->prev && cur->prev->next != cur))
+ error("Broken link in event '%s'", cur->name);
+ }
+ for (todo_t *cur = TODOS; cur; cur = cur->next) {
if (!cur->cal)
error("Missing cal in todo '%s'", cur->name);
+ if ((cur->next && cur->next->prev != cur) ||
+ (cur->prev && cur->prev->next != cur))
+ error("Broken link in todo '%s'", cur->name);
+ }
#endif
}