From 442f8c6d3d42b892e3f13128bcb6487ff7508f0d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 19 Jun 2019 16:05:40 -0400 Subject: Make extractLine return a bool. (#991) --- source/slang/slang-source-loc.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'source/slang/slang-source-loc.cpp') 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& 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 -- cgit v1.2.3