diff --git a/src/scheduler.c b/src/scheduler.c index fa659a5..0fe8630 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -50,25 +50,20 @@ static inline void centerAssign(Center_t *center, int x, int y, int z) static inline Center_t *centerAdd(Center_t *anyCenter, Center_t *newCenter) { - Center_t *temp = anyCenter->next; - anyCenter->next = newCenter; - newCenter->next = temp; - newCenter->prev = anyCenter; - - if (temp) { - temp->prev = newCenter; + if (anyCenter->next) { + anyCenter->next->prev = newCenter; } + newCenter->next = anyCenter->next; + anyCenter->next = newCenter; + newCenter->prev = anyCenter; return newCenter; } static inline void centerRemove(Center_t *oldCenter) { - Center_t *prev = oldCenter->prev; - Center_t *next = oldCenter->next; - - prev->next = next->prev; - next->prev = prev->next; + oldCenter->prev->next = oldCenter->next; + oldCenter->next->prev = oldCenter->prev; free(oldCenter); }