From 5a7640af235a2068c233ce47a56d74defd4c2f0e Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Wed, 2 Oct 2024 15:56:24 +0200 Subject: 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. --- userland/minibox/utilities/ls.c | 1 + 1 file changed, 1 insertion(+) (limited to 'userland/minibox/utilities/ls.c') 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; } -- cgit v1.2.3