if(g_slist_length(intersection) != 0) {  g_slist_free(this_color->details->candidate_nodes); this_color->details->candidate_nodes = intersection; lh_resource->color = this_color; lh_resource->provisional = FALSE; }
if(g_slist_length(intersection) != 0) {  g_slist_free(this_color->details->candidate_nodes); this_color->details->candidate_nodes = intersection; lh_resource->color = this_color; lh_resource->provisional = FALSE; break; } );
choose_color(resource_t *lh_resource, GSListPtr candidate_colors){	int lpc = 0;	GSListPtr sorted_colors = g_slist_sort(candidate_colors,					sort_color_weight);	lh_resource->candidate_colors = sorted_colors;		pdebug(cl_log(LOG_DEBUG,		      "Choose a color from %d possibilities",		      g_slist_length(sorted_colors)));		for(lpc = 0; lh_resource->provisional		    && lpc < g_slist_length(sorted_colors);	    lpc++) {		color_t *this_color = (color_t*)			g_slist_nth_data(sorted_colors, lpc);		GSListPtr intersection =			node_list_and(this_color->details->candidate_nodes, 				      lh_resource->allowed_nodes);		if(g_slist_length(intersection) != 0) {			// TODO: merge node weights			g_slist_free(this_color->details->candidate_nodes);			this_color->details->candidate_nodes = intersection;			lh_resource->color = this_color;			lh_resource->provisional = FALSE;		}	}	return !lh_resource->provisional;}