Commit c61ec246 authored by topjohnwu's avatar topjohnwu

Rename function to be more descriptive

parent fd5ad91d
...@@ -186,5 +186,5 @@ bool check_two_stage() { ...@@ -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");
} }
...@@ -40,7 +40,7 @@ int data_holder::patch(str_pairs list) { ...@@ -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;
......
...@@ -21,7 +21,7 @@ struct data_holder { ...@@ -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);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment