summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-08-20 22:33:12 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2015-08-24 20:24:15 +0200
commitcaa0d0c0a761cdcc516cd9b7a214e5f05526bb9e (patch)
treea4d9d9580c2532c086fbd3093e73a69bba0f0cb9
parent3af8e451f272f1398acf7336f9eff0c64340ffe3 (diff)
downloadandroid-node-v8-caa0d0c0a761cdcc516cd9b7a214e5f05526bb9e.tar.gz
android-node-v8-caa0d0c0a761cdcc516cd9b7a214e5f05526bb9e.tar.bz2
android-node-v8-caa0d0c0a761cdcc516cd9b7a214e5f05526bb9e.zip
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>
-rw-r--r--lib/_stream_readable.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index 766577af58..681c3eaec2 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -192,7 +192,7 @@ Readable.prototype.setEncoding = function(enc) {
// Don't raise the hwm > 8MB
const MAX_HWM = 0x800000;
-function roundUpToNextPowerOf2(n) {
+function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
@@ -231,7 +231,7 @@ function howMuchToRead(n, state) {
// power of 2, to prevent increasing it excessively in tiny
// amounts.
if (n > state.highWaterMark)
- state.highWaterMark = roundUpToNextPowerOf2(n);
+ state.highWaterMark = computeNewHighWaterMark(n);
// don't have that much. return null, unless we've ended.
if (n > state.length) {