bug fix:fix memory leak when parse template
This commit is contained in:
@@ -71,13 +71,13 @@ class Scanner {
|
|||||||
|
|
||||||
var index = content.startIndex
|
var index = content.startIndex
|
||||||
while index != content.endIndex {
|
while index != content.endIndex {
|
||||||
let substring = content[index..<content.endIndex]
|
let substring = content.substringFromIndex(index)
|
||||||
if substring.hasPrefix(until) {
|
if substring.hasPrefix(until) {
|
||||||
let result = content[content.startIndex..<index]
|
let result = content.substringToIndex(index)
|
||||||
content = substring
|
content = substring
|
||||||
|
|
||||||
if returnUntil {
|
if returnUntil {
|
||||||
content = content[until.endIndex..<content.endIndex]
|
content = content.substringFromIndex(until.endIndex)
|
||||||
return result + until
|
return result + until
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,10 +97,10 @@ class Scanner {
|
|||||||
|
|
||||||
var index = content.startIndex
|
var index = content.startIndex
|
||||||
while index != content.endIndex {
|
while index != content.endIndex {
|
||||||
let substring = content[index..<content.endIndex]
|
let substring = content.substringFromIndex(index)
|
||||||
for string in until {
|
for string in until {
|
||||||
if substring.hasPrefix(string) {
|
if substring.hasPrefix(string) {
|
||||||
let result = content[content.startIndex..<index]
|
let result = content.substringToIndex(index)
|
||||||
content = substring
|
content = substring
|
||||||
return (string, result)
|
return (string, result)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user