hare

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

commit 60d51baa0049f84de1af4d3c3b3c0dd6ad56bfae
parent a01f4b0ae68dfb85f02861d7a191f8829b0918f9
Author: Sebastian <sebastian@sebsite.pw>
Date:   Mon, 28 Mar 2022 21:04:12 -0400

strings: remove c_empty

This was convenient when Hare strings were null terminated, but it is no
longer needed, since "\0" can be used instead.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mos/exec/exec+linux.ha | 2+-
Mstrings/cstrings.ha | 7-------
2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/os/exec/exec+linux.ha b/os/exec/exec+linux.ha @@ -128,7 +128,7 @@ fn platform_exec(cmd: *command) error = { }; return errors::errno(rt::execveat(cmd.platform, - strings::c_empty, argv: *[*]nullable *const char, + "\0", argv: *[*]nullable *const char, envp: *[*]nullable *const char, rt::AT_EMPTY_PATH)); }; diff --git a/strings/cstrings.ha b/strings/cstrings.ha @@ -4,13 +4,6 @@ // (c) 2022 Vlad-Stefan Harbuz <vlad@vladh.net> use encoding::utf8; use types; -use rt; - -let emptybuf: [1]u8 = [0]; - -// A C-compatible empty string. Empty Hare strings have a null pointer instead -// of containing only '\0', so a special string is needed for this case. -export let c_empty: *const char = &emptybuf: *[*]u8: *const char; // Computes the length of a NUL-terminated C string, in octets, in O(n). The // computed length does not include the NUL terminator.