condense skipWhitespace code

pull/4627/head
oiooj 2015-10-31 03:02:16 +08:00
parent d909b0cf30
commit 5d87439eb3
1 changed files with 4 additions and 9 deletions

View File

@ -726,17 +726,12 @@ func scanBoolean(buf []byte, i int) (int, []byte, error) {
// skipWhitespace returns the end position within buf, starting at i after
// scanning over spaces in tags
func skipWhitespace(buf []byte, i int) int {
for {
if i >= len(buf) {
return i
}
if buf[i] == ' ' || buf[i] == '\t' || buf[i] == 0 {
i += 1
continue
}
for i < len(buf) {
if buf[i] != ' ' && buf[i] != '\t' && buf[i] != 0 {
break
}
i++
}
return i
}