hare

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

commit 859d762b0577d3b3434a8c203a84c69244910609
parent 9f2c3604064440791f73a2627f2bc3e538b6e5e1
Author: Sudipto Mallick <smlckz@envs.net>
Date:   Tue,  6 Apr 2021 20:22:36 +0000

fs::rmdirall: relocate repetitive path::join calls

Diffstat:
Mfs/fs.ha | 14++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/fs/fs.ha b/fs/fs.ha @@ -115,17 +115,11 @@ export fn rmdirall(fs: *fs, path: str) (void | error) = { if (ent.name == "." || ent.name == "..") { continue; }; + let p = path::join(path, ent.name); + defer free(p); switch (ent.ftype) { - mode::DIR => { - let p = path::join(path, ent.name); - defer free(p); - rmdirall(fs, p)?; - }, - * => { - let p = path::join(path, ent.name); - defer free(p); - remove(fs, p)?; - }, + mode::DIR => rmdirall(fs, p)?, + * => remove(fs, p)?, }; }, void => break,