hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit f37b4746f4e762593d6a58997bcdff30b9f08a31
parent 64eed54f29d03bca8edf361748357bd035000c40
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue, 21 Dec 2021 16:16:26 +0100

cmd/hare: take advantage of slice duplication

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mcmd/hare/plan.ha | 2--
Mcmd/hare/schedule.ha | 10+++++-----
2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/cmd/hare/plan.ha b/cmd/hare/plan.ha @@ -230,5 +230,3 @@ fn mkfile(plan: *plan, input: str, ext: str) str = { plan.counter += 1; return path::join(plan.workdir, name); }; - -fn mkdepends(t: *task...) []*task = alloc(t); diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -62,7 +62,7 @@ fn sched_ld(plan: *plan, output: str, depend: *task...) *task = { let task = alloc(task { status = status::SCHEDULED, output = output, - depend = mkdepends(depend...), + depend = alloc(depend...), cmd = alloc([ // C compiler is used as linker if we -l something os::tryenv("LD", @@ -100,7 +100,7 @@ fn sched_ar(plan: *plan, output: str, depend: *task...) *task = { let task = alloc(task { status = status::SCHEDULED, output = output, - depend = mkdepends(depend...), + depend = alloc(depend...), cmd = alloc([ os::tryenv("AR", "ar"), "-csr", output, ]), @@ -118,7 +118,7 @@ fn sched_as(plan: *plan, output: str, input: str, depend: *task...) *task = { let task = alloc(task { status = status::SCHEDULED, output = output, - depend = mkdepends(depend...), + depend = alloc(depend...), cmd = alloc([ os::tryenv("AS", "as"), "-g", "-o", output, input, ]), @@ -132,7 +132,7 @@ fn sched_qbe(plan: *plan, output: str, depend: *task) *task = { let task = alloc(task { status = status::SCHEDULED, output = output, - depend = mkdepends(depend), + depend = alloc([depend]), cmd = alloc([ os::tryenv("QBE", "qbe"), "-o", output, depend.output, ]), @@ -162,7 +162,7 @@ fn sched_hare_object( let harec = alloc(task { status = status::SCHEDULED, output = ssa, - depend = mkdepends(depend...), + depend = alloc(depend...), cmd = alloc([ os::tryenv("HAREC", "harec"), "-o", ssa, ]),