basic/string-util: split out helper function

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-05-05 12:12:42 +02:00
parent 566d06ae50
commit 6302d38609
2 changed files with 4 additions and 4 deletions
+1 -4
View File
@@ -277,10 +277,7 @@ bool string_has_cc(const char *p, const char *ok) {
if (ok && strchr(ok, *t))
continue;
if (*t > 0 && *t < ' ')
return true;
if (*t == 127)
if (char_is_cc(*t))
return true;
}
+3
View File
@@ -129,6 +129,9 @@ static inline bool _pure_ in_charset(const char *s, const char* charset) {
return s[strspn(s, charset)] == '\0';
}
static inline bool char_is_cc(char p) {
return (p >= 0 && p < ' ') || p == 127;
}
bool string_has_cc(const char *p, const char *ok) _pure_;
char *ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_columns, unsigned percent);