summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common.cc2
-rw-r--r--src/voidc.cc11
2 files changed, 10 insertions, 3 deletions
diff --git a/src/common.cc b/src/common.cc
index 5e84c01..12fe710 100644
--- a/src/common.cc
+++ b/src/common.cc
@@ -103,6 +103,8 @@ struct Link {
static inline void link_after(Link* prev, Link* nlink) {
assert_neq(prev, nullptr);
assert_neq(nlink, nullptr);
+ assert_neq(prev, nlink);
+ assert(nlink->prev == nullptr && nlink->next == nullptr);
Link* next = prev->next;
diff --git a/src/voidc.cc b/src/voidc.cc
index 63d2ef7..c6682b2 100644
--- a/src/voidc.cc
+++ b/src/voidc.cc
@@ -23,13 +23,18 @@ int main() {
String file(SOURCE_FILE);
Buffer_Stack stack{};
- Buffer* buffer = nullptr;
+ Buffer* buffer1 = nullptr;
+ Buffer* buffer2 = nullptr;
- bool ret = buffer_init(heap_allocator(), &source, &file, &buffer);
+ bool ret = buffer_init(heap_allocator(), &source, &file, &buffer1);
if (!ret) return EXIT_FAILURE;
- buffer_stack_push(&stack, buffer);
+ ret = buffer_init(heap_allocator(), &source, &file, &buffer2);
+ if (!ret) return EXIT_FAILURE;
+ buffer_stack_push(&stack, buffer1);
+ buffer_stack_push(&stack, buffer2);
+
Tokenizer tokenizer(&stack);
Token token = {};