aboutsummaryrefslogtreecommitdiff
path: root/src/bufio/scan.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2023-09-16 23:18:02 +0700
committerShulhan <m.shulhan@gmail.com>2026-04-14 21:51:40 +0700
commit4f51d4c33231636f46d44f996cf4c6822dd2ee19 (patch)
tree123a7b30936c40e0e19c31807d17599daaca37e6 /src/bufio/scan.go
parent5410be8b93277d2b1d0f701bfa64a4930b31615e (diff)
downloadgo-4f51d4c33231636f46d44f996cf4c6822dd2ee19.tar.xz
bufio: realign struct Scanner
This reduce the Scanner allocation size from 112 to 72 bytes.
Diffstat (limited to 'src/bufio/scan.go')
-rw-r--r--src/bufio/scan.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bufio/scan.go b/src/bufio/scan.go
index 1a0a3907c9..d3ab8acfcc 100644
--- a/src/bufio/scan.go
+++ b/src/bufio/scan.go
@@ -29,12 +29,12 @@ import (
type Scanner struct {
r io.Reader // The reader provided by the client.
split SplitFunc // The function to split the tokens.
- maxTokenSize int // Maximum size of a token; modified by tests.
+ err error // Sticky error.
token []byte // Last token returned by split.
buf []byte // Buffer used as argument to split.
+ maxTokenSize int // Maximum size of a token; modified by tests.
start int // First non-processed byte in buf.
end int // End of data in buf.
- err error // Sticky error.
empties int // Count of successive empty tokens.
scanCalled bool // Scan has been called; buffer is in use.
done bool // Scan has finished.