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

Function php_bucket_next

src/pipeline/pass_pkgmap.c:2650–2670  ·  view source on GitHub ↗

The next usable file of a namespace-map bucket (a '\n'-delimited list of * __file__ QNs): a PHP File node that is not the importing file. Advances * *cursor past the entry. */

Source from the content-addressed store, hash-verified

2648 * __file__ QNs): a PHP File node that is not the importing file. Advances
2649 * *cursor past the entry. */
2650static const cbm_gbuf_node_t *php_bucket_next(const cbm_pipeline_ctx_t *ctx, const char **cursor,
2651 const char *source_file_qn) {
2652 while (*cursor && **cursor) {
2653 const char *seg = *cursor;
2654 const char *eol = strchr(seg, '\n');
2655 size_t len = eol ? (size_t)(eol - seg) : strlen(seg);
2656 *cursor = eol ? eol + SKIP_ONE : NULL;
2657 char qbuf[CBM_SZ_1K];
2658 if (len == 0 || len >= sizeof(qbuf)) {
2659 continue;
2660 }
2661 memcpy(qbuf, seg, len);
2662 qbuf[len] = '\0';
2663 const cbm_gbuf_node_t *n = cbm_gbuf_find_by_qn(ctx->gbuf, qbuf);
2664 if (n && n->label && strcmp(n->label, "File") == 0 && node_in_php_file(n) &&
2665 (!source_file_qn || strcmp(n->qualified_name, source_file_qn) != 0)) {
2666 return n;
2667 }
2668 }
2669 return NULL;
2670}
2671
2672/* The file of `bucket` that defines a symbol named `leaf`, or NULL. Exact:
2673 * the definition must live in that very file (same file_path). */

Callers 2

php_bucket_declaringFunction · 0.85
resolve_php_declared_useFunction · 0.85

Calls 2

cbm_gbuf_find_by_qnFunction · 0.85
node_in_php_fileFunction · 0.85

Tested by

no test coverage detected