Update dstr to use Arena

This commit is contained in:
2024-04-29 22:48:10 +01:00
parent 05e56d67ea
commit e75846a507
2 changed files with 37 additions and 89 deletions

28
src/strings/dstr/dstr.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef DSTR_H
#define DSTR_H
#include "aliases.h"
#include "mem_arena.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
typedef struct dstr String;
String *wapp_dstr_with_capacity(u64 capacity, Arena *arena);
String *wapp_dstr_from_string(const char *str, Arena *arena);
String *wapp_dstr_update(String **dst, const char *src, Arena *arena);
String *wapp_dstr_concat(String **dst, const char *src, Arena *arena);
void wapp_dstr_clear(String *str);
void wapp_dstr_print(const String *str);
i64 wapp_dstr_find(const String *str, const char *substr);
u64 wapp_dstr_length(const String *str);
u64 wapp_dstr_capacity(const String *str);
const char *wapp_dstr_to_cstr(const String *str);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !DSTR_H