Skip to content

Commit

Permalink
remove duplicate subtraction
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Mar 10, 2024
1 parent 7748c79 commit ca4602d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions deps/streamsearch/sbmh.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ class SBMH extends EventEmitter {
// been processed and append the entire haystack
// into it.
const bytesToCutOff = this._lookbehind_size + pos

if (bytesToCutOff > 0) {
// The cut off data is guaranteed not to contain the needle.
this.emit('info', false, this._lookbehind, 0, bytesToCutOff)
}

this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff,
this._lookbehind_size - bytesToCutOff)
this._lookbehind_size -= bytesToCutOff
this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff, this._lookbehind_size)

data.copy(this._lookbehind, this._lookbehind_size)
this._lookbehind_size += len
Expand Down

0 comments on commit ca4602d

Please sign in to comment.