stream: rename poorly named function
roundUpToNextPowerOf2() does more than just rounding up to the next power of two. Rename it to computeNewHighWaterMark(). PR-URL: https://github.com/nodejs/node/pull/2479 Reviewed-By: Chris Dickinson <christopher.s.dickinson@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
parent
3af8e451f2
commit
caa0d0c0a7
@ -192,7 +192,7 @@ Readable.prototype.setEncoding = function(enc) {
|
|||||||
|
|
||||||
// Don't raise the hwm > 8MB
|
// Don't raise the hwm > 8MB
|
||||||
const MAX_HWM = 0x800000;
|
const MAX_HWM = 0x800000;
|
||||||
function roundUpToNextPowerOf2(n) {
|
function computeNewHighWaterMark(n) {
|
||||||
if (n >= MAX_HWM) {
|
if (n >= MAX_HWM) {
|
||||||
n = MAX_HWM;
|
n = MAX_HWM;
|
||||||
} else {
|
} else {
|
||||||
@ -231,7 +231,7 @@ function howMuchToRead(n, state) {
|
|||||||
// power of 2, to prevent increasing it excessively in tiny
|
// power of 2, to prevent increasing it excessively in tiny
|
||||||
// amounts.
|
// amounts.
|
||||||
if (n > state.highWaterMark)
|
if (n > state.highWaterMark)
|
||||||
state.highWaterMark = roundUpToNextPowerOf2(n);
|
state.highWaterMark = computeNewHighWaterMark(n);
|
||||||
|
|
||||||
// don't have that much. return null, unless we've ended.
|
// don't have that much. return null, unless we've ended.
|
||||||
if (n > state.length) {
|
if (n > state.length) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user