mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-17 20:53:12 +00:00
Support bootconfig
https://android-review.googlesource.com/c/platform/system/core/+/1615298
This commit is contained in:
@@ -188,3 +188,16 @@ string &replace_all(string &str, string_view from, string_view to) {
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
vector<string> split(const string& s, const string& delimiters) {
|
||||
vector<string> result;
|
||||
size_t base = 0;
|
||||
size_t found;
|
||||
while (true) {
|
||||
found = s.find_first_of(delimiters, base);
|
||||
result.push_back(s.substr(base, found - base));
|
||||
if (found == string::npos) break;
|
||||
base = found + 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -92,6 +92,18 @@ static inline bool str_starts(std::string_view s, std::string_view ss) {
|
||||
static inline bool str_ends(std::string_view s, std::string_view ss) {
|
||||
return s.size() >= ss.size() && s.compare(s.size() - ss.size(), std::string::npos, ss) == 0;
|
||||
}
|
||||
static inline std::string ltrim(std::string &&s) {
|
||||
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](unsigned char ch) {
|
||||
return !std::isspace(ch);
|
||||
}));
|
||||
return std::move(s);
|
||||
}
|
||||
static inline std::string rtrim(std::string &&s) {
|
||||
s.erase(std::find_if(s.rbegin(), s.rend(), [](unsigned char ch) {
|
||||
return !std::isspace(ch) && ch != '\0';
|
||||
}).base(), s.end());
|
||||
return std::move(s);
|
||||
}
|
||||
|
||||
int fork_dont_care();
|
||||
int fork_no_orphan();
|
||||
@@ -101,6 +113,7 @@ uint32_t binary_gcd(uint32_t u, uint32_t v);
|
||||
int switch_mnt_ns(int pid);
|
||||
int gen_rand_str(char *buf, int len, bool varlen = true);
|
||||
std::string &replace_all(std::string &str, std::string_view from, std::string_view to);
|
||||
std::vector<std::string> split(const std::string& s, const std::string& delimiters);
|
||||
|
||||
struct exec_t {
|
||||
bool err = false;
|
||||
|
Reference in New Issue
Block a user