Commit 320b6fef authored by Daniel Martí's avatar Daniel Martí Committed by Ian Lance Taylor

fmt: remove stopAtNewline unused parameter

This parameter is always false. The last occurrence of s.skipSpace(true)
was removed in mid-2015.

While at it, merge skipSpace into SkipSpace, since the latter was just a
wrapper without the parameter.

Found with github.com/mvdan/unparam.

Change-Id: I884ea4036f41234a898d6aeee515211c49b0b435
Reviewed-on: https://go-review.googlesource.com/52890Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarAvelino <t@avelino.xxx>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
parent 6bf22080
...@@ -298,13 +298,6 @@ func notSpace(r rune) bool { ...@@ -298,13 +298,6 @@ func notSpace(r rune) bool {
return !isSpace(r) return !isSpace(r)
} }
// SkipSpace provides Scan methods the ability to skip space and newline
// characters in keeping with the current scanning mode set by format strings
// and Scan/Scanln.
func (s *ss) SkipSpace() {
s.skipSpace(false)
}
// readRune is a structure to enable reading UTF-8 encoded code points // readRune is a structure to enable reading UTF-8 encoded code points
// from an io.Reader. It is used if the Reader given to the scanner does // from an io.Reader. It is used if the Reader given to the scanner does
// not already implement io.RuneScanner. // not already implement io.RuneScanner.
...@@ -421,8 +414,10 @@ func (s *ss) free(old ssave) { ...@@ -421,8 +414,10 @@ func (s *ss) free(old ssave) {
ssFree.Put(s) ssFree.Put(s)
} }
// skipSpace skips spaces and maybe newlines. // SkipSpace provides Scan methods the ability to skip space and newline
func (s *ss) skipSpace(stopAtNewline bool) { // characters in keeping with the current scanning mode set by format strings
// and Scan/Scanln.
func (s *ss) SkipSpace() {
for { for {
r := s.getRune() r := s.getRune()
if r == eof { if r == eof {
...@@ -432,9 +427,6 @@ func (s *ss) skipSpace(stopAtNewline bool) { ...@@ -432,9 +427,6 @@ func (s *ss) skipSpace(stopAtNewline bool) {
continue continue
} }
if r == '\n' { if r == '\n' {
if stopAtNewline {
break
}
if s.nlIsSpace { if s.nlIsSpace {
continue continue
} }
...@@ -453,7 +445,7 @@ func (s *ss) skipSpace(stopAtNewline bool) { ...@@ -453,7 +445,7 @@ func (s *ss) skipSpace(stopAtNewline bool) {
// newlines are treated as spaces. // newlines are treated as spaces.
func (s *ss) token(skipSpace bool, f func(rune) bool) []byte { func (s *ss) token(skipSpace bool, f func(rune) bool) []byte {
if skipSpace { if skipSpace {
s.skipSpace(false) s.SkipSpace()
} }
// read until white space or newline // read until white space or newline
for { for {
...@@ -537,7 +529,7 @@ func (s *ss) okVerb(verb rune, okVerbs, typ string) bool { ...@@ -537,7 +529,7 @@ func (s *ss) okVerb(verb rune, okVerbs, typ string) bool {
// scanBool returns the value of the boolean represented by the next token. // scanBool returns the value of the boolean represented by the next token.
func (s *ss) scanBool(verb rune) bool { func (s *ss) scanBool(verb rune) bool {
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
if !s.okVerb(verb, "tv", "boolean") { if !s.okVerb(verb, "tv", "boolean") {
return false return false
...@@ -641,7 +633,7 @@ func (s *ss) scanInt(verb rune, bitSize int) int64 { ...@@ -641,7 +633,7 @@ func (s *ss) scanInt(verb rune, bitSize int) int64 {
if verb == 'c' { if verb == 'c' {
return s.scanRune(bitSize) return s.scanRune(bitSize)
} }
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
base, digits := s.getBase(verb) base, digits := s.getBase(verb)
haveDigits := false haveDigits := false
...@@ -674,7 +666,7 @@ func (s *ss) scanUint(verb rune, bitSize int) uint64 { ...@@ -674,7 +666,7 @@ func (s *ss) scanUint(verb rune, bitSize int) uint64 {
if verb == 'c' { if verb == 'c' {
return uint64(s.scanRune(bitSize)) return uint64(s.scanRune(bitSize))
} }
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
base, digits := s.getBase(verb) base, digits := s.getBase(verb)
haveDigits := false haveDigits := false
...@@ -795,7 +787,7 @@ func (s *ss) scanComplex(verb rune, n int) complex128 { ...@@ -795,7 +787,7 @@ func (s *ss) scanComplex(verb rune, n int) complex128 {
if !s.okVerb(verb, floatVerbs, "complex") { if !s.okVerb(verb, floatVerbs, "complex") {
return 0 return 0
} }
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
sreal, simag := s.complexTokens() sreal, simag := s.complexTokens()
real := s.convertFloat(sreal, n/2) real := s.convertFloat(sreal, n/2)
...@@ -809,7 +801,7 @@ func (s *ss) convertString(verb rune) (str string) { ...@@ -809,7 +801,7 @@ func (s *ss) convertString(verb rune) (str string) {
if !s.okVerb(verb, "svqxX", "string") { if !s.okVerb(verb, "svqxX", "string") {
return "" return ""
} }
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
switch verb { switch verb {
case 'q': case 'q':
...@@ -973,13 +965,13 @@ func (s *ss) scanOne(verb rune, arg interface{}) { ...@@ -973,13 +965,13 @@ func (s *ss) scanOne(verb rune, arg interface{}) {
// scan in high precision and convert, in order to preserve the correct error condition. // scan in high precision and convert, in order to preserve the correct error condition.
case *float32: case *float32:
if s.okVerb(verb, floatVerbs, "float32") { if s.okVerb(verb, floatVerbs, "float32") {
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
*v = float32(s.convertFloat(s.floatToken(), 32)) *v = float32(s.convertFloat(s.floatToken(), 32))
} }
case *float64: case *float64:
if s.okVerb(verb, floatVerbs, "float64") { if s.okVerb(verb, floatVerbs, "float64") {
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
*v = s.convertFloat(s.floatToken(), 64) *v = s.convertFloat(s.floatToken(), 64)
} }
...@@ -1017,7 +1009,7 @@ func (s *ss) scanOne(verb rune, arg interface{}) { ...@@ -1017,7 +1009,7 @@ func (s *ss) scanOne(verb rune, arg interface{}) {
v.Index(i).SetUint(uint64(str[i])) v.Index(i).SetUint(uint64(str[i]))
} }
case reflect.Float32, reflect.Float64: case reflect.Float32, reflect.Float64:
s.skipSpace(false) s.SkipSpace()
s.notEOF() s.notEOF()
v.SetFloat(s.convertFloat(s.floatToken(), v.Type().Bits())) v.SetFloat(s.convertFloat(s.floatToken(), v.Type().Bits()))
case reflect.Complex64, reflect.Complex128: case reflect.Complex64, reflect.Complex128:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment