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

Function toml_extract_name

src/pipeline/pass_pkgmap.c:350–373  ·  view source on GitHub ↗

Extract "name" value from a TOML section. Scans from section_start until * the next [...] header or EOF. Returns heap string or NULL. */

Source from the content-addressed store, hash-verified

348/* Extract "name" value from a TOML section. Scans from section_start until
349 * the next [...] header or EOF. Returns heap string or NULL. */
350static char *toml_extract_name(const char *section_start, const char *end) {
351 const char *p = section_start;
352 while (p < end) {
353 while (p < end && (*p == ' ' || *p == '\t')) {
354 p++;
355 }
356 if (p < end && *p == '[') {
357 break;
358 }
359 if (at_prefix(p, end, "name ", TOML_NAME_SP)) {
360 return extract_quoted(p + TOML_NAME_SP, end);
361 }
362 if (at_prefix(p, end, "name=", TOML_NAME_EQ)) {
363 return extract_quoted(p + TOML_NAME_EQ, end);
364 }
365 while (p < end && *p != '\n') {
366 p++;
367 }
368 if (p < end) {
369 p++;
370 }
371 }
372 return NULL;
373}
374
375/* Build entry path: dir/suffix or just suffix if dir is empty. */
376static char *build_entry_path(const char *rel_path, const char *suffix) {

Callers 2

parse_cargo_tomlFunction · 0.85
parse_pyproject_tomlFunction · 0.85

Calls 2

at_prefixFunction · 0.85
extract_quotedFunction · 0.85

Tested by

no test coverage detected