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

Function cbm_regexec

src/foundation/compat_regex.c:39–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39int cbm_regexec(const cbm_regex_t *r, const char *str, int nmatch, cbm_regmatch_t *matches,
40 int eflags) {
41 const regex_t *re = (const regex_t *)r->opaque;
42 if (nmatch <= 0 || !matches) {
43 int rc = tre_regexec(re, str, 0, NULL, eflags);
44 return rc == 0 ? CBM_REG_OK : CBM_REG_NOMATCH;
45 }
46 regmatch_t pmatch[CBM_SZ_32];
47 int n = nmatch > CBM_SZ_32 ? CBM_SZ_32 : nmatch;
48 int rc = tre_regexec(re, str, (size_t)n, pmatch, eflags);
49 if (rc != 0)
50 return CBM_REG_NOMATCH;
51 for (int i = 0; i < n; i++) {
52 matches[i].rm_so = (int)pmatch[i].rm_so;
53 matches[i].rm_eo = (int)pmatch[i].rm_eo;
54 }
55 return CBM_REG_OK;
56}
57
58void cbm_regfree(cbm_regex_t *r) {
59 regex_t *re = (regex_t *)r->opaque;

Callers 11

sqlite_regexpFunction · 0.85
sqlite_iregexpFunction · 0.85
eval_comparison_opFunction · 0.85
check_inline_propsFunction · 0.85
collect_grep_matchesFunction · 0.85
write_scoped_filelistFunction · 0.85
scan_depends_in_sigFunction · 0.85
scan_dockerfile_lineFunction · 0.85
scan_yaml_lineFunction · 0.85
scan_terraform_lineFunction · 0.85
scan_regex_lineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected