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/libc/include/stdlib.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'userland/libc/include/stdlib.h') diff --git a/userland/libc/include/stdlib.h b/userland/libc/include/stdlib.h index 7e23035..a389e8c 100644 --- a/userland/libc/include/stdlib.h +++ b/userland/libc/include/stdlib.h @@ -10,6 +10,8 @@ typedef size_t size_t; // only for 32 bit void *malloc(size_t s); void *calloc(size_t nelem, size_t elsize); +void *allocarray(size_t nmemb, size_t size); +void *reallocarray(void *ptr, size_t nmemb, size_t size); void *realloc(void *ptr, size_t size); void free(void *p); char *getenv(const char *name); -- cgit v1.2.3