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

Function rs_attr_string

internal/cbm/doclink_rs.c:2538–2560  ·  view source on GitHub ↗

The string literal that follows `key =` in text[0..n), copied into `out`. * false when there is none, it holds an escape, or it does not fit. */

Source from the content-addressed store, hash-verified

2536/* The string literal that follows `key =` in text[0..n), copied into `out`.
2537 * false when there is none, it holds an escape, or it does not fit. */
2538static bool rs_attr_string(const char *text, size_t n, char *out, size_t cap) {
2539 const char *eq = (const char *)memchr(text, '=', n);
2540 if (!eq) {
2541 return false;
2542 }
2543 size_t i = (size_t)(eq - text) + SKIP_ONE;
2544 while (i < n && isspace((unsigned char)text[i])) {
2545 i++;
2546 }
2547 if (i >= n || text[i] != '"') {
2548 return false;
2549 }
2550 size_t start = ++i;
2551 while (i < n && text[i] != '"' && text[i] != '\\' && (unsigned char)text[i] >= ' ') {
2552 i++;
2553 }
2554 if (i >= n || text[i] != '"' || i - start >= cap || i == start) {
2555 return false;
2556 }
2557 memcpy(out, text + start, i - start);
2558 out[i - start] = '\0';
2559 return true;
2560}
2561
2562/* The first identifier inside the parentheses of text[0..n). */
2563static void rs_attr_first_arg(const char *text, size_t n, char *out, size_t cap) {

Callers 1

rs_attr_readFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected