From 74933654160064f9303551a6c012be6b88d5b626 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Mon, 2 Mar 2026 12:29:14 +0100 Subject: creating and removing buffer --- src/voidc.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/voidc.cc') 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 #include +#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); + } -- cgit v1.2.3