]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json: use isSpace in stateEndTop
authorGabriel Aszalos <gabriel.aszalos@gmail.com>
Sat, 30 Jun 2018 16:12:24 +0000 (18:12 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 6 Oct 2018 15:40:02 +0000 (15:40 +0000)
This change makes stateEndTop use isSpace instead of specifically
recreating the same functionality.

Change-Id: I81f8f51682e46e7f8e2b9fed423a968457200625
Reviewed-on: https://go-review.googlesource.com/c/121797
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/encoding/json/scanner.go

index 9e6d482e168d31110e25982eec49229e5b212c07..88572245fc71001a03c7f08a4e06b24ae8324437 100644 (file)
@@ -289,7 +289,7 @@ func stateEndValue(s *scanner, c byte) int {
 // such as after reading `{}` or `[1,2,3]`.
 // Only space characters should be seen now.
 func stateEndTop(s *scanner, c byte) int {
-       if c != ' ' && c != '\t' && c != '\r' && c != '\n' {
+       if !isSpace(c) {
                // Complain about non-space byte on next call.
                s.error(c, "after top-level value")
        }