mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-19 20:58:29 +00:00
Directly use memmem in contains
This commit is contained in:
parent
ee4dad7a13
commit
e13775ec2c
@ -14,14 +14,7 @@
|
||||
using namespace std;
|
||||
|
||||
bool byte_view::contains(byte_view pattern) const {
|
||||
if (_buf == nullptr)
|
||||
return false;
|
||||
for (uint8_t *p = _buf, *eof = _buf + _sz; p < eof; ++p) {
|
||||
if (memcmp(p, pattern.buf(), pattern.sz()) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return _buf != nullptr && memmem(_buf, _sz, pattern._buf, pattern._sz) != nullptr;
|
||||
}
|
||||
|
||||
bool byte_view::equals(byte_view o) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user