MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / escape_path_for_report

Function escape_path_for_report

src/os/linux/pagecache.cpp:157–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157std::string escape_path_for_report(const std::string& s) {
158 std::string out;
159 out.reserve(s.size());
160 constexpr char hex[] = "0123456789abcdef";
161 for (unsigned char c : s) {
162 if (c >= 0x20 && c < 0x7f) {
163 out.push_back(static_cast<char>(c));
164 } else {
165 out += "\\x";
166 out.push_back(hex[c >> 4]);
167 out.push_back(hex[c & 0xf]);
168 }
169 }
170 return out;
171}
172
173bool pagecache_path_is_pseudo_fs(std::string_view fs) {
174 static constexpr std::string_view kPseudo[] = {

Callers 1

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected