diff options
Diffstat (limited to 'src/source.cc')
| -rw-r--r-- | src/source.cc | 9 |
1 files changed, 6 insertions, 3 deletions
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 { |
