center_t operations
This commit is contained in:
parent
9248f8176b
commit
6c7a46d3cd
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue