What's this:
Code:
 q = (q->next == oldhead ? NULL : q->next);