summaryrefslogtreecommitdiff
path: root/userland/minibox/utilities
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-10-02 15:56:24 +0200
committerAnton Kling <anton@kling.gg>2024-10-02 16:12:29 +0200
commit5a7640af235a2068c233ce47a56d74defd4c2f0e (patch)
tree5afbb84519a46dc1129d4de7d93f65b56e4cb7e2 /userland/minibox/utilities
parent44848d566066dbea008eecf4c2b9916f051bad06 (diff)
libc: Add faster scandir function(scandir_sane).
This function is significantly faster due to not requiring memory allocations for each directory entry. Now they are instead just allocated as a large chunk. This function is not compatible with scandir since the cleanup of both function will be different. With this a new function scandir_sane_free has also been added. Besides having a function(like scandir) that forces the programmer to implement their own cleanup procedure that is anymore complicated than a simple free() call is absurd.
Diffstat (limited to 'userland/minibox/utilities')
-rw-r--r--userland/minibox/utilities/ls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/userland/minibox/utilities/ls.c b/userland/minibox/utilities/ls.c
index bedc3a3..0ce70f8 100644
--- a/userland/minibox/utilities/ls.c
+++ b/userland/minibox/utilities/ls.c
@@ -40,5 +40,6 @@ int ls_main(int argc, char **argv) {
printf("%s", namelist[i]->d_name);
}
putchar('\n');
+ scandir_sane_free(namelist);
return 0;
}