if (debug) log_d("set_connection_state: %d %d", c - connection_array, state);
void set_connection_state(struct connection *c, enum connection_state state){	enum connection_state oldstate;	struct connection_list *o, *n;	if (debug)		log_d("set_connection_state: %d %d", c - connection_array, state);	oldstate = c->connection_state;	if (state == oldstate) {		log_d("set_connection_state: state == oldstate (%d)", state);		return;	}	switch (oldstate) {	case HC_UNATTACHED:		o = 0;		break;	case HC_FREE:		o = &free_connections;		break;	case HC_WAITING:		o = &waiting_connections;		break;	case HC_READING:		o = &reading_connections;		break;	case HC_WRITING:		o = &writing_connections;		break;	case HC_FORKED:		o = &forked_connections;		break;	default:		log_d("set_connection_state: unknown state: %d", state);		abort();	}	switch (state) {	case HC_UNATTACHED:		n = 0;		break;	case HC_FREE:		n = &free_connections;		break;	case HC_WAITING:		n = &waiting_connections;		break;	case HC_READING:		n = &reading_connections;		break;	case HC_WRITING:		n = &writing_connections;		break;	case HC_FORKED:		n = &forked_connections;		break;	default:		log_d("set_connection_state: unknown state: %d", state);		abort();	}	if (o)		c_unlink(c, o);	c->connection_state = state;	if (n)		c_link(c, n);}