summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/array.cc9
-rw-r--r--src/source.cc9
-rw-r--r--src/voidc.cc2
3 files changed, 16 insertions, 4 deletions
diff --git a/src/array.cc b/src/array.cc
new file mode 100644
index 0000000..0238c05
--- /dev/null
+++ b/src/array.cc
@@ -0,0 +1,9 @@
+#ifndef ARRAY_CC
+#define ARRAY_CC
+
+template<typename T>
+struct Array {
+
+};
+
+#endif
diff --git a/src/source.cc b/src/source.cc
index d714f29..63fbdea 100644
--- a/src/source.cc
+++ b/src/source.cc
@@ -17,6 +17,7 @@ struct Buffer {
String file;
String content;
Link link;
+ const Allocator* allocator;
};
bool buffer_init(Buffer* buffer, const Allocator* allocator, const String* content_in, const String* file_in) {
@@ -33,12 +34,14 @@ bool buffer_init(Buffer* buffer, const Allocator* allocator, const String* conte
buffer->file = file;
buffer->content = content;
buffer->link = {};
+ buffer->allocator = allocator;
return true;
}
-void buffer_deinit(Buffer* buffer, const Allocator* allocator) {
- slice_deallocate(allocator, &buffer->file);
- slice_deallocate(allocator, &buffer->content);
+void buffer_deinit(Buffer* buffer) {
+ slice_deallocate(buffer->allocator, &buffer->file);
+ slice_deallocate(buffer->allocator, &buffer->content);
+ buffer->allocator = nullptr;
}
struct Buffer_Stack {
diff --git a/src/voidc.cc b/src/voidc.cc
index 5bbd7f4..69dc4ed 100644
--- a/src/voidc.cc
+++ b/src/voidc.cc
@@ -24,5 +24,5 @@ int main() {
bool ret = buffer_init(&buffer, heap_allocator(), &source, &file);
if(!ret) return EXIT_FAILURE;
-
+ buffer_deinit(&buffer);
}