commit 4f116159a5912f3fada28e0c108d28645ebc7399
parent e0c55f90741758207b580df22d776af6976f3a70
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date: Sun, 20 Feb 2022 01:58:50 +0100
all: remove namespace prefixes from local objects
Signed-off-by: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Diffstat:
12 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/fs/fs.ha b/fs/fs.ha
@@ -107,14 +107,14 @@ export fn move(fs: *fs, oldpath: str, newpath: str) (void | error) = {
// TODO:
// - If an error occurs, remove the new file.
// - Move non-regular files
- let st = fs::stat(fs, oldpath)?;
+ let st = stat(fs, oldpath)?;
assert(isfile(st.mode), "TODO: move non-regular files");
- let new = fs::create(fs, newpath, st.mode)?;
+ let new = create(fs, newpath, st.mode)?;
defer io::close(new);
- let old = fs::open(fs, oldpath)?;
+ let old = open(fs, oldpath)?;
defer io::close(old);
io::copy(new, old)?;
- fs::remove(fs, oldpath)?;
+ remove(fs, oldpath)?;
};
// Returns an iterator for a path, which yields the contents of a directory.
diff --git a/fs/util.ha b/fs/util.ha
@@ -158,7 +158,7 @@ export fn realpath(fs: *fs, path: str) (str | error) = {
};
const item = path::add(&buf, item)!;
- const link = match (fs::readlink(fs, item)) {
+ const link = match (readlink(fs, item)) {
case let link: str =>
yield link;
case wrongtype =>
diff --git a/io/+test/limit.ha b/io/+test/limit.ha
@@ -22,7 +22,7 @@ use errors;
case error =>
abort();
};
- assert(read(&rlimit, buf) is io::EOF);
+ assert(read(&rlimit, buf) is EOF);
let wlimit = limitwriter(&source, 20);
match (read(&wlimit, buf)) {
diff --git a/io/drain.ha b/io/drain.ha
@@ -1,5 +1,5 @@
// Reads an entire stream into a []u8. The caller must free the return value.
-export fn drain(in: io::handle) ([]u8 | io::error) = {
+export fn drain(in: handle) ([]u8 | error) = {
let sink: []u8 = [];
static let buf: [4096]u8 = [0...];
for (true) {
diff --git a/io/empty.ha b/io/empty.ha
@@ -5,7 +5,7 @@ const _empty: stream = stream {
};
// A [[stream]] which always reads EOF and discards any writes.
-export const empty: *io::stream = &_empty;
+export const empty: *stream = &_empty;
fn empty_read(s: *stream, buf: []u8) (size | EOF | error) = EOF;
diff --git a/io/limit.ha b/io/limit.ha
@@ -35,7 +35,7 @@ export fn limitwriter(source: handle, limit: size) limitstream = {
fn limit_read(s: *stream, buf: []u8) (size | EOF | error) = {
let stream = s: *limitstream;
if (stream.limit == 0) {
- return io::EOF;
+ return EOF;
};
if (len(buf) > stream.limit) {
buf = buf[..stream.limit];
diff --git a/io/util.ha b/io/util.ha
@@ -6,8 +6,8 @@
export fn readitem(in: handle, item: *void, itemsz: size) (size | error) = {
let buf = item: *[*]u8, i = 0z;
for (i < itemsz) {
- match (io::read(in, buf[..(itemsz - i)])) {
- case io::EOF =>
+ match (read(in, buf[..(itemsz - i)])) {
+ case EOF =>
return underread;
case let z: size =>
i += z;
@@ -31,7 +31,7 @@ export fn readitems(in: handle, items: []void, itemsz: size) (size | error) = {
export fn writeitem(out: handle, item: *void, itemsz: size) (size | error) = {
let buf = item: *[*]u8, i = 0z;
for (i < itemsz) {
- i += io::write(out, buf[i..(itemsz - i)])?;
+ i += write(out, buf[i..(itemsz - i)])?;
};
return i;
};
diff --git a/os/+linux/dirfdfs.ha b/os/+linux/dirfdfs.ha
@@ -368,7 +368,7 @@ fn fs_resolve(fs: *fs::fs, path: str) str = {
};
// XXX: This approach might not be right if this fs is based on a subdir
static let buf = path::buffer { ... };
- path::set(&buf, os::getcwd(), path)!;
+ path::set(&buf, getcwd(), path)!;
return path::string(&buf);
};
diff --git a/strconv/+test/stoi.ha b/strconv/+test/stoi.ha
@@ -1,7 +1,7 @@
@test fn stoi() void = {
- assert(stoi64("") as invalid == 0: strconv::invalid);
- assert(stoi64("abc") as invalid == 0: strconv::invalid);
- assert(stoi64("1a") as invalid == 1: strconv::invalid);
+ assert(stoi64("") as invalid == 0: invalid);
+ assert(stoi64("abc") as invalid == 0: invalid);
+ assert(stoi64("1a") as invalid == 1: invalid);
assert(stoi64("9223372036854775808") is overflow);
assert(stoi64("-9223372036854775809") is overflow);
diff --git a/strconv/+test/stou.ha b/strconv/+test/stou.ha
@@ -1,8 +1,8 @@
@test fn stou() void = {
- assert(stou64("") as invalid == 0: strconv::invalid);
- assert(stou64("abc") as invalid == 0: strconv::invalid);
- assert(stou64("1a") as invalid == 1: strconv::invalid);
- assert(stou64("-1") as invalid == 0: strconv::invalid);
+ assert(stou64("") as invalid == 0: invalid);
+ assert(stou64("abc") as invalid == 0: invalid);
+ assert(stou64("1a") as invalid == 1: invalid);
+ assert(stou64("-1") as invalid == 0: invalid);
assert(stou64("18446744073709551616") is overflow);
assert(stou64("184467440737095516150") is overflow);
diff --git a/strings/dup.ha b/strings/dup.ha
@@ -24,7 +24,7 @@ export fn dup(s: const str) str = {
export fn dupall(s: []str) []str = {
let newsl = alloc([""...], len(s));
for (let i = 0z; i < len(s); i += 1) {
- newsl[i] = strings::dup(s[i]);
+ newsl[i] = dup(s[i]);
};
return newsl;
};
diff --git a/strings/sub.ha b/strings/sub.ha
@@ -5,7 +5,7 @@ export type end = void;
fn utf8_byte_len_bounded(iter: *iterator, end: size) size = {
let pos = 0z;
for (let i = 0z; i < end; i += 1) {
- let r = match (strings::next(iter)) {
+ let r = match (next(iter)) {
case let r: rune =>
yield r;
case void =>
@@ -20,7 +20,7 @@ fn utf8_byte_len_bounded(iter: *iterator, end: size) size = {
fn utf8_byte_len_unbounded(iter: *iterator) size = {
let pos = 0z;
for (true) {
- let r = match (strings::next(iter)) {
+ let r = match (next(iter)) {
case let r: rune =>
yield r;
case void =>