[Pkg-javascript-commits] [node-hash-base] 02/03: Use this._block as local variable

Bastien Roucariès rouca at moszumanska.debian.org
Thu May 4 10:21:24 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to annotated tag v2.0.1
in repository node-hash-base.

commit aa8bab94e5d2a905c1abd913684fc00ae6db7a69
Author: Kirill Fomichev <fanatid at ya.ru>
Date:   Thu Apr 14 16:02:51 2016 +0300

    Use this._block as local variable
---
 index.js | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/index.js b/index.js
index dbb8360..f0bc04e 100644
--- a/index.js
+++ b/index.js
@@ -20,16 +20,14 @@ HashBase.prototype.update = function (data, encoding) {
   if (!Buffer.isBuffer(data)) data = new Buffer(data, encoding || 'binary')
 
   // consume data
+  var block = this._block
   var offset = 0
   while (this._blockOffset + data.length - offset >= this._blockSize) {
-    for (var i = this._blockOffset; i < this._blockSize;) this._block[i++] = data[offset++]
+    for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]
     this._update()
     this._blockOffset = 0
   }
-
-  while (offset < data.length) {
-    this._block[this._blockOffset++] = data[offset++]
-  }
+  while (offset < data.length) block[this._blockOffset++] = data[offset++]
 
   // update length
   for (var j = 0, carry = data.length * 8; carry > 0; ++j) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-hash-base.git



More information about the Pkg-javascript-commits mailing list