Skip to content

Commit

Permalink
isl_scheduler.c: graph_find_compressed_node: extract out is_node
Browse files Browse the repository at this point in the history
This reduces some clutter from graph_find_compressed_node and
will make it easier to change the graph that is expected
to contain the node in the next commit.

Signed-off-by: Sven Verdoolaege <[email protected]>
  • Loading branch information
Sven Verdoolaege committed Jul 30, 2017
1 parent d1b1363 commit 2dcebe4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion isl_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,14 @@ static struct isl_sched_node *graph_find_node(isl_ctx *ctx,
return entry ? entry->data : NULL;
}

/* Is "node" a node in "graph"?
*/
static int is_node(struct isl_sched_graph *graph,
struct isl_sched_node *node)
{
return node && node >= &graph->node[0] && node < &graph->node[graph->n];
}

static int edge_has_src_and_dst(const void *entry, const void *val)
{
const struct isl_sched_edge *edge = entry;
Expand Down Expand Up @@ -3887,7 +3895,7 @@ static struct isl_sched_node *graph_find_compressed_node(isl_ctx *ctx,
if (!node)
return NULL;

if (!(node >= &graph->node[0] && node < &graph->node[graph->n]))
if (!is_node(graph, node))
isl_die(ctx, isl_error_internal,
"space points to invalid node", return NULL);

Expand Down

0 comments on commit 2dcebe4

Please sign in to comment.