diff options
| author | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:32:05 +0100 |
|---|---|---|
| committer | Fabrice <fabrice@schaub-dev.xyz> | 2026-03-02 12:32:05 +0100 |
| commit | ef816e31ba15bbda487298339c5ca88456c31d33 (patch) | |
| tree | 9762c3630113f58215ad4244e1a04271bcacc7f9 /src/source.cc | |
| parent | 74933654160064f9303551a6c012be6b88d5b626 (diff) | |
store pointer inside source
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 { |
