if(good_head.right == &good_head) head = &bad_head; else head = &good_head;  ptr = head->right; best = NULL; while (ptr != head) { if (ptr->profit > bestprofit) { bestprofit = ptr->profit; best = ptr;
for (i = 0; i < 0x10000; i++) { if (token_profit[i] > bestprofit) { best = i; bestprofit = token_profit[i];
static struct token *find_best_token(void){	struct token *ptr,*best,*head;	int bestprofit;	bestprofit=-10000;	/* failsafe: if the "good" list is empty search from the "bad" list */	if(good_head.right == &good_head) head = &bad_head;	else head = &good_head;	ptr = head->right;	best = NULL;	while (ptr != head) {		if (ptr->profit > bestprofit) {			bestprofit = ptr->profit;			best = ptr;		}		ptr = ptr->right;	}	return best;}