Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Merge two initialization loops in dijkstra_to
Browse files Browse the repository at this point in the history
  • Loading branch information
iaguis authored and joaquimrocha committed Jun 23, 2013
1 parent a47ad7d commit 701cdef
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions skeltrack/skeltrack-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,22 +506,18 @@ dijkstra_to (GList *nodes, Node *source, Node *target,
PQueue *queue = pqueue_new (g_list_length (nodes), width, height);
GList *current;

for (current = g_list_first (nodes);
previous != NULL && current != NULL;
current = g_list_next (current))
{
Node *node;
node = (Node *) current->data;
previous[node->j * width + node->i] = NULL;
}

for (current = g_list_first (nodes);
current != NULL;
current = g_list_next (current))
{
Node *node;
node = (Node *) current->data;

if (previous != NULL)
{
previous[node->j * width + node->i] = NULL;
}

if (node == source)
{
pqueue_insert (queue, node, 0);
Expand Down

0 comments on commit 701cdef

Please sign in to comment.