Skip to content

Commit

Permalink
core: Improve malloy::file_contents() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tectu committed Nov 25, 2024
1 parent 75ca1f0 commit 38c11c7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/malloy/core/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ namespace malloy
return { };

// Read contents
const std::size_t& size = std::filesystem::file_size(path);
std::string content(size, '\0');
file.read(content.data(), size);
std::string content{std::istreambuf_iterator<char>(file), std::istreambuf_iterator<char>()};

// Close the file
file.close();
Expand Down

0 comments on commit 38c11c7

Please sign in to comment.