entry->client = client;
if(last_entry)
last_entry->next = entry;
+ else
+ last_entry = entry;
if(!first_entry)
first_entry = entry;
return entry;
}
if(entry == NULL) return NULL;
if(freeEntry) {
- first_entry = first_entry->next;
- if(last_entry == first_entry)
- last_entry = NULL;
+ if(entry == first_entry)
+ first_entry = entry->next;
+ if(entry == last_entry) {
+ struct WHOQueueEntry *last;
+ for(last = first_entry; last; last = last->next)
+ if(last->next == NULL) break;
+ last_entry = last;
+ }
}
return entry;
}