MCPcopy Create free account
hub / github.com/antirez/ds4 / renderer_markdown_commit_backticks

Function renderer_markdown_commit_backticks

ds4_agent.c:2478–2494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2476 t->total += n;
2477
2478 if (n >= t->cap) {
2479 memcpy(t->buf, s + n - t->cap, t->cap);
2480 t->start = 0;
2481 t->len = t->cap;
2482 return;
2483 }
2484
2485 if (t->len < t->cap) {
2486 size_t free_tail = t->cap - t->len;
2487 size_t first = n < free_tail ? n : free_tail;
2488 size_t pos = (t->start + t->len) % t->cap;
2489 size_t right = t->cap - pos;
2490 size_t chunk = first < right ? first : right;
2491 memcpy(t->buf + pos, s, chunk);
2492 if (first > chunk) memcpy(t->buf, s + chunk, first - chunk);
2493 t->len += first;
2494 s += first;
2495 n -= first;
2496 }
2497

Callers 2

renderer_markdown_feedFunction · 0.85
renderer_markdown_finishFunction · 0.85

Calls 5

renderer_code_endFunction · 0.85
renderer_code_beginFunction · 0.85

Tested by

no test coverage detected