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-02-03 18:04:30 +0700
commita145075005e7f3ead28ff8a517728c4a8a14fa0c (patch)
treef0e11eb23f7c0cb1a759152bb912ee04265fe362 /src/bufio/scan.go
parent2c5946be59a4aa22833f83d5d7265be0ffe18f0e (diff)
downloadgo-a145075005e7f3ead28ff8a517728c4a8a14fa0c.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.