Add dstr_t type

This commit is contained in:
2023-06-18 21:40:36 +01:00
parent 0095d8fe61
commit 57fe5ab1b7
5 changed files with 284 additions and 9 deletions

19
include/dstring/dstring.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef DSTRING_H
#define DSTRING_H
#include "aliases.h"
typedef struct dstr dstr_t;
dstr_t *dstr_with_capacity(u64 capacity);
dstr_t *dstr_from_string(const char *str);
void update_dstr(dstr_t **dst, const char *src);
void delete_dstr(dstr_t **str);
void concat_dstr(dstr_t **dst, const char *src);
void append_to_dstr(dstr_t **dst, char c);
void empty_dstr(dstr_t *str);
void print_dstr(const dstr_t *str);
u64 dstr_length(const dstr_t *str);
u64 dstr_capacity(const dstr_t *str);
#endif // !DSTRING_H