summaryrefslogtreecommitdiff
path: root/source/slang/slang-source-loc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-source-loc.cpp')
-rw-r--r--source/slang/slang-source-loc.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/source/slang/slang-source-loc.cpp b/source/slang/slang-source-loc.cpp
index e6882ff55..72f921369 100644
--- a/source/slang/slang-source-loc.cpp
+++ b/source/slang/slang-source-loc.cpp
@@ -211,16 +211,10 @@ const List<uint32_t>& SourceFile::getLineBreakOffsets()
// cache an array of line break locations in the file.
if (m_lineBreakOffsets.getCount() == 0)
{
- UnownedStringSlice content = getContent();
+ UnownedStringSlice content(getContent()), line;
char const* contentBegin = content.begin();
-
- while (true)
+ while (StringUtil::extractLine(content, line))
{
- auto line = StringUtil::extractLine(content);
- if (line.begin() == nullptr)
- {
- break;
- }
m_lineBreakOffsets.add(uint32_t(line.begin() - contentBegin));
}
// Note that we do *not* treat the end of the file as a line