diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:29:14 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:29:14 +0100 |
| commit | 74933654160064f9303551a6c012be6b88d5b626 (patch) | |
| tree | 95191a4335f1a59a407cde9cba010a6c59ebab41 /src/voidc.cc | |
| parent | df736f5a97b329377e45adb8d734fd58ea9b14ac (diff) | |
creating and removing buffer
Diffstat (limited to 'src/voidc.cc')
| -rw-r--r-- | src/voidc.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/voidc.cc b/src/voidc.cc index 8110184..5bbd7f4 100644 --- a/src/voidc.cc +++ b/src/voidc.cc @@ -1,5 +1,7 @@ +#include <cstdlib> #include <cstring> +#include "source.cc" #include "common.cc" #include "memory.cc" @@ -11,13 +13,16 @@ int main() { } )"; -static const String SOURCE_STRING = {(u8*)SOURCE, strlen(SOURCE)}; -int main() { - String source; - slice_copy(heap_allocator(), &SOURCE_STRING, &source); +static const char* SOURCE_FILE = "source.c"; - slice_write(&source, stdout); +int main() { + String source(SOURCE); + String file(SOURCE_FILE); + + Buffer buffer{}; + bool ret = buffer_init(&buffer, heap_allocator(), &source, &file); + if(!ret) return EXIT_FAILURE; - slice_deallocate(heap_allocator(), &source); + } |
