MCPcopy Create free account
hub / github.com/git/git / match_funcname

Function match_funcname

grep.c:1329–1354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1327}
1328
1329static int match_funcname(struct grep_opt *opt, struct grep_source *gs,
1330 const char *bol, const char *eol)
1331{
1332 xdemitconf_t *xecfg = opt->priv;
1333 if (xecfg && !xecfg->find_func) {
1334 grep_source_load_driver(gs, opt->repo->index);
1335 if (gs->driver->funcname.pattern) {
1336 const struct userdiff_funcname *pe = &gs->driver->funcname;
1337 xdiff_set_find_func(xecfg, pe->pattern, pe->cflags);
1338 } else {
1339 xecfg = opt->priv = NULL;
1340 }
1341 }
1342
1343 if (xecfg) {
1344 char buf[1];
1345 return xecfg->find_func(bol, eol - bol, buf, 1,
1346 xecfg->find_func_priv) >= 0;
1347 }
1348
1349 if (bol == eol)
1350 return 0;
1351 if (isalpha(*bol) || *bol == '_' || *bol == '$')
1352 return 1;
1353 return 0;
1354}
1355
1356static void show_funcname_line(struct grep_opt *opt, struct grep_source *gs,
1357 const char *bol, unsigned lno)

Callers 3

show_funcname_lineFunction · 0.70
show_pre_contextFunction · 0.70
grep_source_1Function · 0.70

Calls 2

grep_source_load_driverFunction · 0.85
xdiff_set_find_funcFunction · 0.85

Tested by

no test coverage detected