The node of sub `name` of file f; NULL when it has none of its own. */
| 324 | |
| 325 | /* The node of sub `name` of file f; NULL when it has none of its own. */ |
| 326 | static const cbm_gbuf_node_t *pr_sub_node(const pr_ctx_t *c, const pr_file_t *f, const char *name) { |
| 327 | size_t ql = strlen(f->module_qn); |
| 328 | size_t nl = strlen(name); |
| 329 | char stack[CBM_SZ_512]; |
| 330 | char *qn = ql + nl + PAIR_LEN <= sizeof(stack) |
| 331 | ? stack |
| 332 | : (char *)cbm_alloc(CBM_MEM_CLASS_OTHER, ql + nl + PAIR_LEN); |
| 333 | if (!qn) { |
| 334 | return NULL; |
| 335 | } |
| 336 | memcpy(qn, f->module_qn, ql); |
| 337 | qn[ql] = '.'; |
| 338 | memcpy(qn + ql + SKIP_ONE, name, nl + SKIP_ONE); |
| 339 | const cbm_gbuf_node_t *n = cbm_gbuf_find_by_qn(c->g, qn); |
| 340 | if (qn != stack) { |
| 341 | cbm_free(CBM_MEM_CLASS_OTHER, qn); |
| 342 | } |
| 343 | return (pr_node_is(n, f, "Function") || pr_node_is(n, f, "Method")) ? n : NULL; |
| 344 | } |
| 345 | |
| 346 | static bool pr_has_sub(const pr_file_t *f, const char *name) { |
| 347 | for (int i = 0; i < f->nsubs; i++) { |
no test coverage detected