commit eefbd852f6a3f09f4116ccc0b18bc3e49abcd3b6
parent 31b22bc3f1ca12d9ee0b3081041b02ef4c1c99ea
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 28 Oct 2023 02:35:47 -0400
os: remove finish
This was an alias of fs::finish, which doesn't make sense since os::iter
returns an fs::iterator, and the os-specific finish function is embedded
within the iterator itself so it's called by fs::finish. os::finish also
wasn't ever referenced by the docs, so users have been lead to use
fs::finish anyway.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/cmd/hare/cache.ha b/cmd/hare/cache.ha
@@ -49,7 +49,7 @@ fn cache(name: str, cmd: *getopt::command) (void | error) = {
fn dirsize(buf: *path::buffer) (size | error) = {
let s = 0z;
let it = os::iter(path::string(buf))?;
- defer os::finish(it);
+ defer fs::finish(it);
for (true) match (fs::next(it)) {
case void =>
break;
diff --git a/os/os.ha b/os/os.ha
@@ -27,9 +27,6 @@ export fn move(oldpath: str, newpath: str) (void | fs::error) =
// done using the object.
export fn iter(path: str) (*fs::iterator | fs::error) = fs::iter(cwd, path);
-// Frees state associated with a directory iterator.
-export fn finish(iter: *fs::iterator) void = fs::finish(iter);
-
// Reads all entries from a directory. The caller must free the return value
// with [[fs::dirents_free]].
export fn readdir(path: str) ([]fs::dirent | fs::error) = fs::readdir(cwd, path);