hare

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

commit 98189ab4e70f6d8f93807d2c8e26e94a05740ca7
parent daa85419c44df08f6c4c3f9ffdce9c632b3d275a
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat,  8 Jan 2022 13:59:20 +0100

path: add path::set

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

Diffstat:
Mpath/buffer.ha | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/path/buffer.ha b/path/buffer.ha @@ -19,6 +19,13 @@ export fn reset(buf: *buffer) void = { buf.cur = buf.buf[..0]; }; +// Sets the value of a path buffer to a list of components, overwriting any +// previous value. +export fn set(buf: *buffer, items: str...) (void | errors::overflow) = { + reset(buf); + return add(buf, items...); +}; + // Creates a copy of another path buffer, which can be modified without // affecting the original. export fn dup(buf: *buffer) buffer = {