MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / tp_pattern_valid

Function tp_pattern_valid

src/mcp/test_impact_policy.c:133–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static 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. */

Callers 2

tp_add_expansionFunction · 0.85
tp_expand_patternFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected