ses_cross_graph.c
authoryu.dongliang <18588496441@163.com>
Wed, 1 Nov 2023 06:59:44 +0000 (14:59 +0800)
committeryu.dongliang <18588496441@163.com>
Wed, 1 Nov 2023 06:59:44 +0000 (14:59 +0800)
ses_cross_graph.c
ses_layout.c

index c12690f06f785b989abd4ff34c25d5bcdea161fd..63d013834d54a33049b64484c85850d909b82d36 100644 (file)
@@ -26,11 +26,6 @@ next:
        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;
@@ -46,6 +41,13 @@ static int __cross_kcolor_check(scf_vector_t* graph)
        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;
@@ -147,9 +149,7 @@ static int __cross_kcolor_fill(scf_vector_t* graph, int k, scf_vector_t* colors,
                        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);
@@ -166,10 +166,8 @@ static int __cross_kcolor_fill(scf_vector_t* graph, int k, scf_vector_t* colors,
                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))
@@ -288,7 +286,7 @@ static int __cross_graph_kcolor(scf_vector_t* graph, int k, scf_vector_t* colors
        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)
@@ -321,10 +319,7 @@ static int __cross_graph_kcolor(scf_vector_t* graph, int k, scf_vector_t* colors
                        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)
index 0134c0db8e51b51529c16dd8b79fe3b2800bd999..62109971a484d662f815cdaf04d9439256984a6a 100644 (file)
@@ -1272,7 +1272,7 @@ int ses_cross(ScfEfunction* f, int d)
 
        int ret = ses_cross_graph_kcolor(graph, N, colors);
        if (ret < 0) {
-               scf_loge("\n");
+               scf_loge("**********\n");
        }
 
        for (i = 0; i < graph->size; i++) {