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

Function rs_inline_runs

internal/cbm/doclink_rs.c:1763–1782  ·  view source on GitHub ↗

Record the paragraph's backtick runs, in text order and by length: a code * span closes at the first later run of its opener's length, which is then a * binary search instead of a scan of the rest of the paragraph. */

Source from the content-addressed store, hash-verified

1761 * span closes at the first later run of its opener's length, which is then a
1762 * binary search instead of a scan of the rest of the paragraph. */
1763static void rs_inline_runs(rs_inline_t *in) {
1764 in->nruns = 0;
1765 in->run_cursor = 0;
1766 for (uint32_t i = 0; i < in->n;) {
1767 if (in->s[i] != '`') {
1768 i++;
1769 continue;
1770 }
1771 uint32_t e = i;
1772 while (e < in->n && in->s[e] == '`') {
1773 e++;
1774 }
1775 in->runs[in->nruns++] = (rs_run_t){.pos = i, .len = e - i};
1776 i = e;
1777 }
1778 if (in->nruns > 0) {
1779 memcpy(in->by_len, in->runs, (size_t)in->nruns * sizeof(rs_run_t));
1780 qsort(in->by_len, (size_t)in->nruns, sizeof(rs_run_t), rs_run_len_cmp);
1781 }
1782}
1783
1784/* Past the code span that opens at the backtick s[i], or past its run alone
1785 * when no later run has the opener's length. The opener is what is left of

Callers 1

rs_scan_paragraphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected