hare

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

commit 0bf26c68a25a31cc5e5f3d84167645ebf3a73ccc
parent 5e628befce69407234939459bc14b1fe3c26d12d
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Thu,  4 Feb 2021 17:17:54 -0500

os::init_environ: replace horrible hack with append

Diffstat:
Mos/+linux/environ.ha | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/os/+linux/environ.ha b/os/+linux/environ.ha @@ -14,14 +14,16 @@ let args_static: [32]str = [""...]; @init fn init_environ() void = { if (rt::argc < len(args_static)) { args = args_static[..rt::argc]; + for (let i = 0z; i < rt::argc; i += 1z) { + args[i] = strings::from_c(rt::argv[i]); + }; } else { args = alloc([]str, [], rt::argc); - (&args: *types::slice).length = rt::argc; // HORRIBLE HACK + for (let i = 0z; i < rt::argc; i += 1z) { + append(args, strings::from_c(rt::argv[i])); + }; }; - for (let i = 0z; i < rt::argc; i += 1z) { - args[i] = strings::from_c(rt::argv[i]); - }; }; @fini fn fini_environ() void = {