Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Realized there's no reason to pass cyclePath by reference.
Browse files Browse the repository at this point in the history
  • Loading branch information
schveiguy committed Aug 11, 2016
1 parent 89b1ef3 commit 50a40f7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/rt/minfo.d
Expand Up @@ -58,12 +58,13 @@ struct ModuleGroup
// target modules are involved in a cycle.
//
// The delegate is a helper to map module info pointers to index into the modules array
private void genCyclePath(ref int[] cyclePath, int srcidx, int targetidx,
private int[] genCyclePath(int srcidx, int targetidx,
scope int delegate(immutable(ModuleInfo)*) findModule)
{
import core.bitop : bt, btc, bts;

// set up all the arrays. Use the GC, we are going to exit anyway.
int[] cyclePath;
int[] distance;
int[][] edges;
distance.length = _modules.length;
Expand Down Expand Up @@ -171,6 +172,7 @@ struct ModuleGroup
// now get back.
shortest(targetidx, srcidx);

return cyclePath;
}

/******************************
Expand Down Expand Up @@ -342,8 +344,7 @@ struct ModuleGroup

string errmsg = "Cyclic dependency between module "
~ cycleMod.name ~ " and " ~ current.name ~ EOL;
int[] cyclePath;
genCyclePath(cyclePath, cycleIdx, cast(int) curidx, &findModule);
auto cyclePath = genCyclePath(cycleIdx, cast(int) curidx, &findModule);

foreach (midx; cyclePath[0 .. $ - 1])
{
Expand Down

0 comments on commit 50a40f7

Please sign in to comment.