hare

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

commit 346355647f9e0b1c19223acdc5d47ba47cb4b4b6
parent 72f7faaf96f289b8a1e420a257ee631fc087de0e
Author: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Date:   Thu, 16 Sep 2021 14:50:12 +0200

fs: Change is_something functions to issomething

This is more consistent with the informal style guide, and function
names in other modules.

Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>

Diffstat:
Mdirs/xdg.ha | 2+-
Mfs/fs.ha | 2+-
Mfs/util.ha | 14+++++++-------
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/dirs/xdg.ha b/dirs/xdg.ha @@ -13,7 +13,7 @@ fn lookup(prog: str, var: str, default: str) str = { return path; }, st: fs::filestat => { - if (fs::is_dir(st.mode)) { + if (fs::isdir(st.mode)) { return path; }; }, diff --git a/fs/fs.ha b/fs/fs.ha @@ -94,7 +94,7 @@ export fn move(fs: *fs, oldpath: str, newpath: str) (void | error) = { // - If an error occurs, remove the new file. // - Move non-regular files let st = fs::stat(fs, oldpath)?; - assert(is_file(st.mode), "TODO: move non-regular files"); + assert(isfile(st.mode), "TODO: move non-regular files"); let new = fs::create(fs, newpath, st.mode)?; defer io::close(new); let old = fs::open(fs, oldpath)?; diff --git a/fs/util.ha b/fs/util.ha @@ -61,25 +61,25 @@ export fn mode_perm(m: mode) mode = (m: uint & 0o777u): mode; export fn mode_type(m: mode) mode = (m: uint & ~0o777u): mode; // Returns true if this item is a regular file. -export fn is_file(mode: mode) bool = mode & mode::REG == mode::REG; +export fn isfile(mode: mode) bool = mode & mode::REG == mode::REG; // Returns true if this item is a FIFO (named pipe). -export fn is_fifo(mode: mode) bool = mode & mode::FIFO == mode::FIFO; +export fn isfifo(mode: mode) bool = mode & mode::FIFO == mode::FIFO; // Returns true if this item is a directory. -export fn is_dir(mode: mode) bool = mode & mode::DIR == mode::DIR; +export fn isdir(mode: mode) bool = mode & mode::DIR == mode::DIR; // Returns true if this item is a character device. -export fn is_chdev(mode: mode) bool = mode & mode::CHR == mode::CHR; +export fn ischdev(mode: mode) bool = mode & mode::CHR == mode::CHR; // Returns true if this item is a block device. -export fn is_blockdev(mode: mode) bool = mode & mode::BLK == mode::BLK; +export fn isblockdev(mode: mode) bool = mode & mode::BLK == mode::BLK; // Returns true if this item is a symbolic link. -export fn is_link(mode: mode) bool = mode & mode::LINK == mode::LINK; +export fn islink(mode: mode) bool = mode & mode::LINK == mode::LINK; // Returns true if this item is a Unix socket. -export fn is_socket(mode: mode) bool = mode & mode::SOCK == mode::SOCK; +export fn issocket(mode: mode) bool = mode & mode::SOCK == mode::SOCK; // Reads all entries from a directory. The caller must free the return value // with [[dirents_free]].