mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
code review: avoid pointless test for single-char cells
This commit is contained in:
parent
f71d3689a9
commit
da605f53a6
1 changed files with 3 additions and 3 deletions
|
|
@ -400,8 +400,8 @@ HNTrieBuilder.prototype.HNTrie8.prototype.matches = function(needle) {
|
|||
}
|
||||
if ( c1 === 0 ) { return true; }
|
||||
ccnt = this.buf[i+3];
|
||||
if ( ccnt > ichar ) { return false; }
|
||||
if ( ccnt !== 0 ) { // cell is only one character
|
||||
if ( ccnt > ichar ) { return false; }
|
||||
ic = ccnt; i1 = ichar-1; i2 = i+4;
|
||||
while ( ic-- && needle.charCodeAt(i1-ic) === this.buf[i2+ic] );
|
||||
if ( ic !== -1 ) { return false; }
|
||||
|
|
@ -431,8 +431,8 @@ HNTrieBuilder.prototype.HNTrie16.prototype.matches = function(needle) {
|
|||
}
|
||||
if ( c1 === 0 ) { return true; }
|
||||
ccnt = this.buf[i+3];
|
||||
if ( ccnt > ichar ) { return false; }
|
||||
if ( ccnt !== 0 ) { // cell is only one character
|
||||
if ( ccnt > ichar ) { return false; }
|
||||
ic = ccnt; i1 = ichar-1; i2 = i+4;
|
||||
while ( ic-- && needle.charCodeAt(i1-ic) === this.buf[i2+ic] );
|
||||
if ( ic !== -1 ) { return false; }
|
||||
|
|
@ -462,8 +462,8 @@ HNTrieBuilder.prototype.HNTrie32.prototype.matches = function(needle) {
|
|||
}
|
||||
if ( c1 === 0 ) { return true; }
|
||||
ccnt = this.buf[i+3];
|
||||
if ( ccnt > ichar ) { return false; }
|
||||
if ( ccnt !== 0 ) { // cell is only one character
|
||||
if ( ccnt > ichar ) { return false; }
|
||||
ic = ccnt; i1 = ichar-1; i2 = i+4;
|
||||
while ( ic-- && needle.charCodeAt(i1-ic) === this.buf[i2+ic] );
|
||||
if ( ic !== -1 ) { return false; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue