Rename function to be more descriptive

This commit is contained in:
topjohnwu 2020-09-04 06:21:25 -07:00
parent fd5ad91d26
commit c61ec2465f
3 changed files with 3 additions and 3 deletions

View File

@ -186,5 +186,5 @@ bool check_two_stage() {
return true; return true;
// If we still have no indication, parse the original init and see what's up // If we still have no indication, parse the original init and see what's up
auto init = raw_data::mmap_ro("/.backup/init"); auto init = raw_data::mmap_ro("/.backup/init");
return init.find("selinux_setup"); return init.contains("selinux_setup");
} }

View File

@ -40,7 +40,7 @@ int data_holder::patch(str_pairs list) {
return count; return count;
} }
bool data_holder::find(string_view pattern) { bool data_holder::contains(string_view pattern) {
for (uint8_t *p = buf, *eof = buf + sz; p < eof; ++p) { for (uint8_t *p = buf, *eof = buf + sz; p < eof; ++p) {
if (memcmp(p, pattern.data(), pattern.length() + 1) == 0) if (memcmp(p, pattern.data(), pattern.length() + 1) == 0)
return true; return true;

View File

@ -21,7 +21,7 @@ struct data_holder {
size_t sz = 0; size_t sz = 0;
using str_pairs = std::initializer_list<std::pair<std::string_view, std::string_view>>; using str_pairs = std::initializer_list<std::pair<std::string_view, std::string_view>>;
int patch(str_pairs list); int patch(str_pairs list);
bool find(std::string_view pattern); bool contains(std::string_view pattern);
protected: protected:
void consume(data_holder &other); void consume(data_holder &other);
}; };