Germany
https://fosstodon.org/@tomterl
Keyoxide: Tomterl
Website: https://www.tomsdiner.org
IRC channel for the projects here on sr.ht: #tomterl
From Tom Regner to ~tomterl/public-inbox
Thanks a lot!
From Tom Regner to ~sircmpwn/hare-users
Hi, I’m in the process of developing a drop in replacement for a tool; for that I need long options. I searched through the archives (hare-dev, hare-users) and tickets for ’getopt’ and ’getopt long’ without success. I assume the decision to not support GNU style long options is intentional to keep everything as concise as possible. Is this assumption correct? Or would an extension to support this be welcome? I’m going to write this anyway, the question is - just as module, as ext-lib or in stdlib? kind regards, Tom
From Tom Regner to ~sircmpwn/hare-dev
If neither TZ exists in the env, nor /etc/localtime (or an equivalent for the system) the TC_LOCAL.zones must not be freed. Signed-off-by: Tom Regner <tomte@tomsdiner.org> --- Style: free is on its own line now time/chrono/timezone.ha | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/time/chrono/timezone.ha b/time/chrono/timezone.ha index a2c759b3..04be427d 100644 --- a/time/chrono/timezone.ha +++ b/time/chrono/timezone.ha @@ -199,14 +199,16 @@ export fn fixedzone(ts: *timescale, daylen: time::duration, z: zone) timezone = [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
If neither TZ exists in the env, nor /etc/localtime (or an equivalent for the system) the TC_LOCAL.zones must not be freed. Signed-off-by: Tom Regner <tomte@tomsdiner.org> --- time/chrono/timezone.ha | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/time/chrono/timezone.ha b/time/chrono/timezone.ha index a2c759b3..a396a7b2 100644 --- a/time/chrono/timezone.ha +++ b/time/chrono/timezone.ha @@ -199,14 +199,16 @@ export fn fixedzone(ts: *timescale, daylen: time::duration, z: zone) timezone = // name of both the timezone and its single zero-offset zone. [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
free everything allocated during @init, so that valgrind reports no possible leaks when using time. Signed-off-by: Tom Regner <tomte@tomsdiner.org> --- time/chrono/leapsec.ha | 5 +++++ time/chrono/timezone.ha | 5 +++++ time/chrono/tzdb.ha | 15 ++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/time/chrono/leapsec.ha b/time/chrono/leapsec.ha index 8d4b2609..8d9686ae 100644 --- a/time/chrono/leapsec.ha +++ b/time/chrono/leapsec.ha [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
Now signed-off - to be clear, this is not an @init sequence related fix, but simple memory leaks fixed. Signed-off-by: Tom Regner <tomte@tomsdiner.org> --- free everything allocated during @init, so that valgrind reports no possible leaks when using time. time/chrono/leapsec.ha | 5 +++++ time/chrono/timezone.ha | 5 +++++ time/chrono/tzdb.ha | 15 ++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/time/chrono/leapsec.ha b/time/chrono/leapsec.ha index 8d4b2609..8d9686ae 100644 [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
--- free everything allocated during @init, so that valgrind reports no possible leaks when using time. time/chrono/leapsec.ha | 5 +++++ time/chrono/timezone.ha | 5 +++++ time/chrono/tzdb.ha | 15 ++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/time/chrono/leapsec.ha b/time/chrono/leapsec.ha index 8d4b2609..8d9686ae 100644 --- a/time/chrono/leapsec.ha +++ b/time/chrono/leapsec.ha [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
I set up a temp dir in an @init function. This crashes, if my @init is executed before os's @init, because the envrionment is accessed before it's setup. Allow the same workaround as for os::init_cwd, calling os::init_environ from a moduled @init fn. This is linux only, as I don't have a freebsd to test, even if the patch is trivial. --- call init_environ in @init; export it; execute init code only once. os/+linux/environ+libc.ha | 31 ++++++++++++++++++++----------- os/+linux/environ.ha | 33 +++++++++++++++++++++------------ 2 files changed, 41 insertions(+), 23 deletions(-) diff --git a/os/+linux/environ+libc.ha b/os/+linux/environ+libc.ha [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
Using void as no-op, as suggested. --- strings/tokenize.ha | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/strings/tokenize.ha b/strings/tokenize.ha index 94a5d8dd..e859bc03 100644 --- a/strings/tokenize.ha +++ b/strings/tokenize.ha @@ -86,7 +86,11 @@ export fn splitn(in: str, delim: str, n: size) []str = { return toks; }; }; [message trimmed]
From Tom Regner to ~sircmpwn/hare-dev
I did expect to be able to use join and splitn as inverse operations: join("=", splitn("one", "=", 2)) == "one" Currently the behaviour is: join("=", splitn("one", "=", 2)) == "one=" I solved this by peeking into the next token, and only append the rest of the tokens if there is one. I'm unclear about the noop in the null branch - I opted for true, but that looks a bit funky. --- strings/tokenize.ha | 13 ++++++++++++- [message trimmed]