+ orig = clients;
+ clients = NULL;
+
+ while((c = orig)) {
+ orig = orig->next;
+ detach(c);
+
+ for(p = clients; p && p->next && p->weight <= c->weight; p = p->next);
+ c->prev = p;
+ if(p) {
+ if((c->next = p->next))
+ c->next->prev = c;
+ p->next = c;