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

Commit 50a40f7

Browse files
committed
Realized there's no reason to pass cyclePath by reference.
1 parent 89b1ef3 commit 50a40f7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/rt/minfo.d

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ struct ModuleGroup
5858
// target modules are involved in a cycle.
5959
//
6060
// The delegate is a helper to map module info pointers to index into the modules array
61-
private void genCyclePath(ref int[] cyclePath, int srcidx, int targetidx,
61+
private int[] genCyclePath(int srcidx, int targetidx,
6262
scope int delegate(immutable(ModuleInfo)*) findModule)
6363
{
6464
import core.bitop : bt, btc, bts;
6565

6666
// set up all the arrays. Use the GC, we are going to exit anyway.
67+
int[] cyclePath;
6768
int[] distance;
6869
int[][] edges;
6970
distance.length = _modules.length;
@@ -171,6 +172,7 @@ struct ModuleGroup
171172
// now get back.
172173
shortest(targetidx, srcidx);
173174

175+
return cyclePath;
174176
}
175177

176178
/******************************
@@ -342,8 +344,7 @@ struct ModuleGroup
342344

343345
string errmsg = "Cyclic dependency between module "
344346
~ cycleMod.name ~ " and " ~ current.name ~ EOL;
345-
int[] cyclePath;
346-
genCyclePath(cyclePath, cycleIdx, cast(int) curidx, &findModule);
347+
auto cyclePath = genCyclePath(cycleIdx, cast(int) curidx, &findModule);
347348

348349
foreach (midx; cyclePath[0 .. $ - 1])
349350
{

0 commit comments

Comments
 (0)