blob: dbaff7acddc78ab3c46a5bcbc996e9c7617d2bf6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#ifndef AMR_STR
#define AMR_STR
#include <assert.h>
#include <string.h>
#define MemCopy memcpy
// @todo: the function names have been changed a bit for the interest
// of speed. Some structs and functions share the same names, so
// I need to fix this but also make sure the functions have good names
enum StrStatus {STR_OK=0, STR_FULL};
struct str8 {
u8 *buffer;
u64 size;
};
struct str8_node {
str8_node *next;
str8 string;
};
struct str8_list {
str8_node *first;
str8_node *last;
u64 count;
u64 capacity;
};
struct res_str8 {
str8 string;
u64 bytes_count;
enum StrStatus status;
};
struct str8 Str8(u8 *string, u64 size);
u64 CstrSize(const char* cstr);
struct res_str8 Str8InitCstr(struct arena *a, const char* cstr, u64 size);
#endif
|