mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-16 15:43:22 +00:00
Make Utf8CStr a first class citizen in C++ codebase
Utf8CStr is in many cases a better string view class than std::string_view, because it provides "view" access to a string buffer that is guaranteed to be null terminated. It also has the additional benefit of being UTF-8 verified and can seemlessly cross FFI boundaries. We would want to start use more Utf8CStr in our existing C++ codebase.
This commit is contained in:
@@ -301,7 +301,8 @@ static bool proc_is_restricted(pid_t pid) {
|
||||
uint32_t data[_LINUX_CAPABILITY_U32S_3] = {};
|
||||
ssprintf(buf, sizeof(buf), "/proc/%d/status", pid);
|
||||
owned_fd status_fd = xopen(buf, O_RDONLY | O_CLOEXEC);
|
||||
file_readline(status_fd, [&](string_view line) -> bool {
|
||||
file_readline(status_fd, [&](Utf8CStr s) -> bool {
|
||||
string_view line = s;
|
||||
if (line.starts_with(bnd)) {
|
||||
auto p = line.begin();
|
||||
advance(p, bnd.size());
|
||||
|
||||
Reference in New Issue
Block a user