Commit a50225a
committed
bufio: make Reader.Reset and Writer.Reset work on the zero value
For batch allocation reasons, it would be useful to nest a
bufio.Reader or bufio.Writer in a struct as a value,
rather than a pointer. When the Reset method is called,
have it use the default buffer size if the buffer is nil.
Fixes #45374
Change-Id: I80df18a13575431428a42ed150a1579de1282637
Reviewed-on: https://go-review.googlesource.com/c/go/+/345570
Trust: Joe Tsai <[email protected]>
Run-TryBot: Joe Tsai <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>1 parent cf2fe5d commit a50225a
2 files changed
+34
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
71 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
| |||
590 | 595 | | |
591 | 596 | | |
592 | 597 | | |
| 598 | + | |
| 599 | + | |
593 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
594 | 604 | | |
595 | 605 | | |
596 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1312 | 1312 | | |
1313 | 1313 | | |
1314 | 1314 | | |
| 1315 | + | |
1315 | 1316 | | |
1316 | 1317 | | |
1317 | 1318 | | |
| |||
1320 | 1321 | | |
1321 | 1322 | | |
1322 | 1323 | | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
1323 | 1334 | | |
1324 | 1335 | | |
1325 | 1336 | | |
1326 | | - | |
| 1337 | + | |
1327 | 1338 | | |
1328 | 1339 | | |
| 1340 | + | |
1329 | 1341 | | |
1330 | 1342 | | |
1331 | 1343 | | |
| |||
1335 | 1347 | | |
1336 | 1348 | | |
1337 | 1349 | | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
1338 | 1361 | | |
1339 | 1362 | | |
1340 | 1363 | | |
| |||
0 commit comments