diff options
| author | Syndamia <kamen@syndamia.com> | 2026-04-28 14:06:44 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2026-05-12 07:08:56 +0300 |
| commit | 0d249b1d47a7f84cfe5f09ad070d1affd26566da (patch) | |
| tree | f395f67eecb27daea3fc4a9ad8e59bf40f988984 /String.h | |
| parent | 5c36b582ad60a569ed996fe188ed92ef6bd7fc5f (diff) | |
| download | foollib-0d249b1d47a7f84cfe5f09ad070d1affd26566da.tar foollib-0d249b1d47a7f84cfe5f09ad070d1affd26566da.tar.gz foollib-0d249b1d47a7f84cfe5f09ad070d1affd26566da.zip | |
feat!: Refactor using MemoryManager
The idea is to provide a universal memory management "API", through
which you allocate and deallocate. This allows our implementations (for
String and Vector) to be more generic.
It does also allow usage of different allocators depending on situation.
Diffstat (limited to 'String.h')
| -rw-r--r-- | String.h | 26 |
1 files changed, 12 insertions, 14 deletions
@@ -1,25 +1,23 @@ #ifndef _STRING #define _STRING -#include "BumpAlloc.h" +#include "MemoryManager.h" +#include <stdarg.h> typedef char* String; -String S_new(BumpArena b, const char* str); -String S_newlen(BumpArena b, usize length); -String S_dup(BumpArena b, String s); -String S_concat(BumpArena b, ...); -String S_printf(BumpArena b, const char* fmt, ...); +String S_new(MemoryManager *mm, const char* str); +String S_newlen(MemoryManager *mm, usize length); +String S_dup(MemoryManager *mm, String s); +String S_vconcat(MemoryManager *mm, va_list args); +String S_concat(MemoryManager *mm, ...); +String S_vprintf(MemoryManager *mm, const char* fmt, va_list args); +String S_printf(MemoryManager *mm, const char* fmt, ...); usize S_length(String s); -Result S_append(String s, const char* str); -Result S_prepend(String s, const char* str); +Result S_append(String *s, const char* str); +Result S_prepend(String *s, const char* str); usize S_find(String s, char c); - -String SG_new(const char* str); -String SG_newlen(usize length); -String SG_dup(String s); -String SG_concat(const char* str, ...); -String SG_printf(const char* fmt, ...); +Result S_free(String s); #endif /* _STRING */ |
