From a67d4744d78fc58846f29667ae49cee70fa0bf16 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Sun, 13 Oct 2024 13:33:29 +0200 Subject: libc/sb: Refactor string builder to allow for none malloc allocations A lot of code written usually has means of doing allocations in a more optimal way than having the string builder library doing it itself. For example a temporary buffer can be allocated on the stack and the string builder functions can then make use of this buffer without ever having to run malloc/free(which would be expensive) --- userland/libc/stdlib/realpath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'userland/libc/stdlib/realpath.c') diff --git a/userland/libc/stdlib/realpath.c b/userland/libc/stdlib/realpath.c index 7ce0f6c..86ac4ed 100644 --- a/userland/libc/stdlib/realpath.c +++ b/userland/libc/stdlib/realpath.c @@ -16,7 +16,7 @@ char *realpath(const char *filename, char *resolvedname) { strcat(cwd, filename); // FIXME: bounds check struct sb string; - sb_init(&string, 512); + sb_init_capacity(&string, 256); struct sv path = C_TO_SV(cwd); -- cgit v1.2.3