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

Function spawn_first_literal

internal/cbm/spawn_patterns.c:504–525  ·  view source on GitHub ↗

The first quoted literal in `text` ("..", '..' or `..`), copied without * its quotes. False when there is none. */

Source from the content-addressed store, hash-verified

502/* The first quoted literal in `text` ("..", '..' or `..`), copied without
503 * its quotes. False when there is none. */
504static bool spawn_first_literal(const char *text, char *out, size_t n) {
505 for (const char *p = text; *p; p++) {
506 if (*p != '"' && *p != '\'' && *p != '`') {
507 continue;
508 }
509 const char *end = p + 1;
510 while (*end && *end != *p) {
511 end += (*end == '\\' && end[1]) ? 2 : 1;
512 }
513 if (!*end) {
514 return false;
515 }
516 size_t len = (size_t)(end - p - 1);
517 if (len >= n) {
518 len = n - 1;
519 }
520 memcpy(out, p + 1, len);
521 out[len] = '\0';
522 return true;
523 }
524 return false;
525}
526
527static const char *spawn_arg_expr(const CBMCall *call, int index) {
528 for (int i = 0; i < call->arg_count; i++) {

Callers 3

spawn_leading_literalFunction · 0.85
spawn_arg_literalFunction · 0.85
cbm_spawn_programFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected