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

Function regex_one_letter_alternation

tests/test_platform.c:1174–1185  ·  view source on GitHub ↗

Writes "(a|b|c|...)" with `branches` one-letter alternatives into buf, which * must hold 2 * branches + 2 bytes. */

Source from the content-addressed store, hash-verified

1172/* Writes "(a|b|c|...)" with `branches` one-letter alternatives into buf, which
1173 * must hold 2 * branches + 2 bytes. */
1174static void regex_one_letter_alternation(char *buf, int branches) {
1175 char *w = buf;
1176 *w++ = '(';
1177 for (int i = 0; i < branches; i++) {
1178 if (i) {
1179 *w++ = '|';
1180 }
1181 *w++ = (char)('a' + i % 26);
1182 }
1183 *w++ = ')';
1184 *w = '\0';
1185}
1186
1187/* Both regex backends expand `X{m,n}` into n copies of X at compile time, so
1188 * nested intervals multiply and a 25-byte pattern can ask for millions of

Callers 1

test_platform.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected