summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-18 01:42:13 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-18 01:42:13 +0100
commit847719ba79186611709a0c46cea41d83578dbda1 (patch)
tree5b0211b9cab6124fd8a819edaf6ed1e7f93c7abe
parentac7f5641f8cfb1d66d48d8388828f9e1f73d2714 (diff)
downloadnimgit-847719ba79186611709a0c46cea41d83578dbda1.tar.gz
nimgit-847719ba79186611709a0c46cea41d83578dbda1.tar.bz2
nimgit-847719ba79186611709a0c46cea41d83578dbda1.zip
utils.nim: cleanup
-rw-r--r--nimgit/utils.nim24
1 files changed, 8 insertions, 16 deletions
diff --git a/nimgit/utils.nim b/nimgit/utils.nim
index 32e55fc..4a133e7 100644
--- a/nimgit/utils.nim
+++ b/nimgit/utils.nim
@@ -20,22 +20,14 @@ proc parseGitSignature* (signature: ptr git_signature): GitSignature =
proc filemodeStr* (m: int): string =
var mode = align("", sizeof(m), '-')
- if S_ISREG(cast[Mode](m)):
- mode[0] = '-'
- elif S_ISBLK(cast[Mode](m)):
- mode[0] = 'b';
- elif S_ISCHR(cast[Mode](m)):
- mode[0] = 'c';
- elif S_ISDIR(cast[Mode](m)):
- mode[0] = 'd';
- elif S_ISFIFO(cast[Mode](m)):
- mode[0] = 'p';
- elif S_ISLNK(cast[Mode](m)):
- mode[0] = 'l';
- elif S_ISSOCK(cast[Mode](m)):
- mode[0] = 's';
- else:
- mode[0] = '?';
+ if S_ISREG(cast[Mode](m)): mode[0] = '-'
+ elif S_ISBLK(cast[Mode](m)): mode[0] = 'b'
+ elif S_ISCHR(cast[Mode](m)): mode[0] = 'c'
+ elif S_ISDIR(cast[Mode](m)): mode[0] = 'd'
+ elif S_ISFIFO(cast[Mode](m)): mode[0] = 'p'
+ elif S_ISLNK(cast[Mode](m)): mode[0] = 'l'
+ elif S_ISSOCK(cast[Mode](m)): mode[0] = 's'
+ else: mode[0] = '?'
if cast[bool](m and S_IRUSR): mode[1] = 'r'