|
diff --git a/README.md b/README.md
|
| ... |
| 103 |
Ideal for parsing and passing strings around without allocation. |
103 |
Ideal for parsing and passing strings around without allocation. |
| 104 |
|
104 |
|
| 105 |
```c |
105 |
```c |
| 106 |
const char* raw = "Hello World"; |
106 |
const char *raw = "Hello World"; |
| 107 |
stringv sv = sv_from_cstr(raw); |
107 |
stringv sv = sv_from_cstr(raw); |
| 108 |
stringv word = sv_slice(sv, 0, 5); // "Hello" (no allocation) |
108 |
stringv word = sv_slice(sv, 0, 5); // "Hello" (no allocation) |
| 109 |
|
109 |
|
| ... |
| 136 |
Arena arena = arena_make(); |
136 |
Arena arena = arena_make(); |
| 137 |
|
137 |
|
| 138 |
// Allocations are fast and contiguous within blocks |
138 |
// Allocations are fast and contiguous within blocks |
| 139 |
void* obj1 = arena_alloc(&arena, 64); |
139 |
void *obj1 = arena_alloc(&arena, 64); |
| 140 |
void* obj2 = arena_alloc(&arena, 128); |
140 |
void *obj2 = arena_alloc(&arena, 128); |
| 141 |
|
141 |
|
| 142 |
// growth is automatic if a block is full |
142 |
// growth is automatic if a block is full |
| 143 |
|
143 |
|
| ... |
| 151 |
|
151 |
|
| 152 |
```c |
152 |
```c |
| 153 |
size_t size; |
153 |
size_t size; |
| 154 |
char* content = read_entire_file("data.txt", &size); |
154 |
char *content = read_entire_file("data.txt", &size); |
| 155 |
|
155 |
|
| 156 |
if (content) { |
156 |
if (content) { |
| 157 |
printf("Read %zu bytes:\n%s\n", size, content); |
157 |
printf("Read %zu bytes:\n%s\n", size, content); |
| ... |