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

Function rst_section_of

internal/cbm/doclink_rst.c:1726–1738  ·  view source on GitHub ↗

The section a 0-based line is written in (by its title block's first line). */

Source from the content-addressed store, hash-verified

1724
1725/* The section a 0-based line is written in (by its title block's first line). */
1726static const rst_title_t *rst_section_of(const rst_doc_t *d, int line) {
1727 int lo = 0;
1728 int hi = d->ntitles;
1729 while (lo < hi) {
1730 int mid = lo + ((hi - lo) / 2);
1731 if (d->titles[mid].first <= line) {
1732 lo = mid + 1;
1733 } else {
1734 hi = mid;
1735 }
1736 }
1737 return lo > 0 ? &d->titles[lo - 1] : NULL;
1738}
1739
1740void cbm_doclink_rst_scan_file(CBMExtractCtx *ctx) {
1741 if (!ctx || !ctx->result || !ctx->source || ctx->source_len <= 0) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected