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)
|
static inline Center_t *centerAdd(Center_t *anyCenter, Center_t *newCenter)
|
||||||
{
|
{
|
||||||
Center_t *temp = anyCenter->next;
|
if (anyCenter->next) {
|
||||||
anyCenter->next = newCenter;
|
anyCenter->next->prev = newCenter;
|
||||||
newCenter->next = temp;
|
|
||||||
newCenter->prev = anyCenter;
|
|
||||||
|
|
||||||
if (temp) {
|
|
||||||
temp->prev = newCenter;
|
|
||||||
}
|
}
|
||||||
|
newCenter->next = anyCenter->next;
|
||||||
|
anyCenter->next = newCenter;
|
||||||
|
newCenter->prev = anyCenter;
|
||||||
|
|
||||||
return newCenter;
|
return newCenter;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void centerRemove(Center_t *oldCenter)
|
static inline void centerRemove(Center_t *oldCenter)
|
||||||
{
|
{
|
||||||
Center_t *prev = oldCenter->prev;
|
oldCenter->prev->next = oldCenter->next;
|
||||||
Center_t *next = oldCenter->next;
|
oldCenter->next->prev = oldCenter->prev;
|
||||||
|
|
||||||
prev->next = next->prev;
|
|
||||||
next->prev = prev->next;
|
|
||||||
|
|
||||||
free(oldCenter);
|
free(oldCenter);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue