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

Function unquote

internal/cbm/extract_env_accesses.c:17–35  ·  view source on GitHub ↗

Unquote a string literal: "foo" -> foo, 'foo' -> foo

Source from the content-addressed store, hash-verified

15
16// Unquote a string literal: "foo" -> foo, 'foo' -> foo
17static const char *unquote(CBMArena *a, const char *s) {
18 if (!s || !s[0]) {
19 return NULL;
20 }
21 // Trim whitespace
22 while (*s == ' ' || *s == '\t') {
23 s++;
24 }
25 size_t len = strlen(s);
26 if (len >= CBM_QUOTE_PAIR) {
27 char first = s[0];
28 char last = s[len - CBM_QUOTE_OFFSET];
29 if ((first == '"' && last == '"') || (first == '\'' && last == '\'') ||
30 (first == '`' && last == '`')) {
31 return cbm_arena_strndup(a, s + CBM_QUOTE_OFFSET, len - CBM_QUOTE_PAIR);
32 }
33 }
34 return s;
35}
36
37// Extract env key from a function call like os.Getenv("KEY").
38static const char *extract_env_key_from_call(CBMExtractCtx *ctx, TSNode node,

Callers 2

Calls 1

cbm_arena_strndupFunction · 0.70

Tested by

no test coverage detected