Remove now-redundant MmappedContent struct

This commit is contained in:
Rangi42
2024-03-27 09:35:19 -04:00
committed by Sylvie
parent 78801e324c
commit b6039870e5
2 changed files with 25 additions and 34 deletions

View File

@@ -46,6 +46,14 @@ struct ContentSpan {
size_t size;
};
struct ViewedContent {
ContentSpan span;
size_t offset = 0;
ViewedContent(ContentSpan const &span_) : span(span_) {}
ViewedContent(std::shared_ptr<char[]> ptr, size_t size) : span({.ptr = ptr, .size = size}) {}
};
struct BufferedContent {
int fd;
size_t index = 0; // Read index into the buffer
@@ -56,20 +64,6 @@ struct BufferedContent {
~BufferedContent();
};
struct MmappedContent {
ContentSpan span;
size_t offset = 0;
MmappedContent(std::shared_ptr<char[]> ptr, size_t size) : span({.ptr = ptr, .size = size}) {}
};
struct ViewedContent {
ContentSpan span;
size_t offset = 0;
ViewedContent(ContentSpan const &span_) : span(span_) {}
};
struct LexerState {
std::string path;
@@ -92,7 +86,7 @@ struct LexerState {
bool expandStrings;
std::deque<Expansion> expansions; // Front is the innermost current expansion
std::variant<std::monostate, MmappedContent, ViewedContent, BufferedContent> content;
std::variant<std::monostate, ViewedContent, BufferedContent> content;
~LexerState();