perf fix alpine x86
This commit is contained in:
@@ -115,25 +115,6 @@ std::string filter_text(std::string_view s) {
|
||||
int g_col = 0;
|
||||
volatile int g_interrupted = 0;
|
||||
|
||||
std::string cstr(std::string_view text, std::span<const int> codes) {
|
||||
if (!g_col || codes.empty() || text.empty()) return std::string(text);
|
||||
std::string s;
|
||||
s.reserve(text.size() + 16);
|
||||
s += "\033[";
|
||||
for (size_t i = 0; i < codes.size(); i++) {
|
||||
if (i) s += ';';
|
||||
s += sfmt("%d", codes[i]);
|
||||
}
|
||||
s += "m";
|
||||
s += text;
|
||||
s += "\033[0m";
|
||||
return s;
|
||||
}
|
||||
void cprint(std::string_view text, std::span<const int> codes) {
|
||||
std::string w = cstr(text, codes);
|
||||
std::fputs(w.c_str(), stdout);
|
||||
}
|
||||
|
||||
int visible_len(std::string_view s) {
|
||||
int n = 0;
|
||||
const unsigned char *p = (const unsigned char *)s.data();
|
||||
|
||||
Reference in New Issue
Block a user