From: yu.dongliang <18588496441@163.com> Date: Wed, 1 Nov 2023 06:59:44 +0000 (+0800) Subject: ses_cross_graph.c X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=00672d64c0ed74c07d8d86cacc6f8c1b7977390a;p=ses.git ses_cross_graph.c --- diff --git a/ses_cross_graph.c b/ses_cross_graph.c index c12690f..63d0138 100644 --- a/ses_cross_graph.c +++ b/ses_cross_graph.c @@ -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) diff --git a/ses_layout.c b/ses_layout.c index 0134c0d..6210997 100644 --- a/ses_layout.c +++ b/ses_layout.c @@ -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++) {