-
-void actlist_invert_fromto(actlist_t*a, segment_t*s1, segment_t*s2)
-{
- segment_t*left = s1->left;
- segment_t*right = s2->right;
- segment_t*s = s1;
- assert(s!=s2);
- while(1) {
- assert(s);
- segment_t*l = s->left;
- segment_t*r = s->right;
- s->left = r;
- s->right = l;
- if(s==s2)
- break;
- s = r;
- }
- s2->left = left;
- s1->right = right;
- if(left) {
- left->right = s2;
- } else {
- assert(a->list == s1);
- a->list = s2;
- }
- if(right) {
- right->left = s1;
- }
-}