More efficient empty line check

This commit is contained in:
2024-11-22 20:08:07 +11:00
parent 5d3fc9a774
commit 72c4f2ac31

View File

@ -15,7 +15,7 @@ struct ApkRawIndex {
recordLines.reserveCapacity(15)
for line in lines {
if line.trimmingCharacters(in: .whitespaces).isEmpty {
if line.isEmpty || line.allSatisfy(\.isWhitespace) {
if !recordLines.isEmpty {
packages.append(try .init(parsingEntryLines: recordLines))
recordLines.removeAll(keepingCapacity: true)