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

Function cbm_lines_are_macro_invocation

internal/cbm/cbm.c:2655–2668  ·  view source on GitHub ↗

cbm_span_is_macro_invocation over a cbm_line_offsets table: offs[k] is where * 1-based line k+1 starts and offs[nlines] is the end of the source, so a span * costs two reads instead of a walk from byte 0. Same answer as the walk; falls * back to it when there is no table. */

Source from the content-addressed store, hash-verified

2653 * costs two reads instead of a walk from byte 0. Same answer as the walk; falls
2654 * back to it when there is no table. */
2655static bool cbm_lines_are_macro_invocation(const char *src, int src_len, const uint32_t *offs,
2656 uint32_t nlines, uint32_t start_line, uint32_t end_line,
2657 const CBMDefArray *defs) {
2658 if (!offs) {
2659 return cbm_span_is_macro_invocation(src, src_len, start_line, end_line, defs);
2660 }
2661 if (!src || src_len <= 0 || !defs || start_line == 0 || end_line < start_line ||
2662 start_line > nlines) {
2663 return false;
2664 }
2665 uint32_t last = end_line < nlines ? end_line : nlines;
2666 return cbm_byte_span_is_macro_invocation(src, src_len, (int)offs[start_line - 1],
2667 (int)offs[last], defs);
2668}
2669
2670/* #1071 subtraction. Both questions are pure, so asking the cheap one first
2671 * changes no answer: "is the region inside a function?" reads only the

Callers 1

Tested by

no test coverage detected