| 131 | } |
| 132 | |
| 133 | static bool tp_pattern_valid(const char *text, size_t len) { |
| 134 | if (!text || !len || len > TP_MAX_PATTERN || text[0] == '!' || text[0] == '#' || |
| 135 | memchr(text, '\0', len) || memchr(text, '\n', len) || memchr(text, '\r', len)) |
| 136 | return false; |
| 137 | if (text[len - 1] == ' ' || text[len - 1] == '\t') { |
| 138 | size_t escapes = 0; |
| 139 | for (size_t i = len - 1; i && text[i - 1] == '\\'; i--) |
| 140 | escapes++; |
| 141 | if (!(escapes & 1U)) |
| 142 | return false; |
| 143 | } |
| 144 | return true; |
| 145 | } |
| 146 | |
| 147 | /* Braces and commas inside a well-formed class are not expansion syntax. |
| 148 | * An unmatched '[' is a literal; it does not hide later brace syntax. */ |
no outgoing calls
no test coverage detected