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

Function extract_quoted

src/pipeline/pass_pkgmap.c:221–242  ·  view source on GitHub ↗

Extract a quoted string value from position. Handles both "..." and '...' * Returns heap-allocated string, or NULL. */

Source from the content-addressed store, hash-verified

219/* Extract a quoted string value from position. Handles both "..." and '...'
220 * Returns heap-allocated string, or NULL. */
221static char *extract_quoted(const char *p, const char *end) {
222 /* Skip whitespace and = sign */
223 while (p < end && (*p == ' ' || *p == '\t' || *p == '=')) {
224 p++;
225 }
226 if (p >= end) {
227 return NULL;
228 }
229 char quote = *p;
230 if (quote != '"' && quote != '\'') {
231 return NULL;
232 }
233 p++;
234 const char *start = p;
235 while (p < end && *p != quote && *p != '\n') {
236 p++;
237 }
238 if (p >= end || *p != quote) {
239 return NULL;
240 }
241 return cbm_strndup(start, (size_t)(p - start));
242}
243
244/* ── Language-specific manifest parsers ────────────────────────── */
245

Callers 3

toml_extract_nameFunction · 0.85
parse_build_gradleFunction · 0.85
parse_gemspecFunction · 0.85

Calls 1

cbm_strndupFunction · 0.85

Tested by

no test coverage detected