diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-06-19 16:05:40 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-19 16:05:40 -0400 |
| commit | 442f8c6d3d42b892e3f13128bcb6487ff7508f0d (patch) | |
| tree | 79746a98390c49bba9639ee84999304731210a8b /source/slang/slang-source-loc.cpp | |
| parent | 48ae5496516878768d7de241b9b7fbba91fbaa74 (diff) | |
Make extractLine return a bool. (#991)
Diffstat (limited to 'source/slang/slang-source-loc.cpp')
| -rw-r--r-- | source/slang/slang-source-loc.cpp | 10 |
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 |
