return 0;
}
-static int __cross_color_del(scf_vector_t* colors, intptr_t color)
-{
- return scf_vector_del(colors, (void*)color);
-}
-
static int __cross_kcolor_check(scf_vector_t* graph)
{
ses_edge_t* edge;
return 0;
}
+static void __cross_color_del(scf_vector_t* colors, intptr_t color)
+{
+ scf_vector_del(colors, (void*)color);
+
+ assert(!scf_vector_find(colors, (void*)color));
+}
+
static int __cross_graph_add(scf_vector_t* graph, ses_edge_t* edge)
{
ses_edge_t* cross;
cross = edge->crosses->data[j];
if (cross->color > 0) {
- int ret = __cross_color_del(__colors, cross->color);
- if (ret < 0)
- goto error;
+ __cross_color_del(__colors, cross->color);
if (0 != edge->color && edge->color == cross->color) {
scf_logd("edge: %p, cross: %p, color: %#lx:%#lx\n", edge, cross, edge->color, cross->color);
if (0 == edge->color) {
edge->color = __cross_color_select(edge, __colors);
- if (0 == edge->color) {
+ if (0 == edge->color)
edge->color = -1;
- scf_logd("__colors->size: %d\n", __colors->size);
- }
}
if (0 != scf_vector_add(graph, edge))
if (!deleted)
return -ENOMEM;
- scf_logd("graph->size: %d, k: %d\n", graph->size, k);
+ scf_logw("graph->size: %d, k: %d\n", graph->size, k);
int ret = __cross_kcolor_delete(graph, k, deleted);
if (ret < 0)
goto overflow;
edge1->color = edge0->color;
- ret = __cross_color_del(__colors, edge0->color);
- if (ret < 0)
- goto error;
- assert(!scf_vector_find(__colors, (void*)edge0->color));
+ __cross_color_del(__colors, edge0->color);
ret = __cross_graph_del(graph, edge0);
if (ret < 0)