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

Function find_line_value

src/pipeline/pass_pkgmap.c:196–217  ·  view source on GitHub ↗

Find a line starting with a prefix in source. Returns pointer to first char * after prefix, or NULL. Handles leading whitespace. */

Source from the content-addressed store, hash-verified

194/* Find a line starting with a prefix in source. Returns pointer to first char
195 * after prefix, or NULL. Handles leading whitespace. */
196static const char *find_line_value(const char *src, int src_len, const char *prefix) {
197 size_t plen = strlen(prefix);
198 const char *p = src;
199 const char *end = src + src_len;
200 while (p < end) {
201 /* Skip leading whitespace */
202 while (p < end && (*p == ' ' || *p == '\t')) {
203 p++;
204 }
205 if (p + plen <= end && memcmp(p, prefix, plen) == 0) {
206 return p + plen;
207 }
208 /* Skip to next line */
209 while (p < end && *p != '\n') {
210 p++;
211 }
212 if (p < end) {
213 p++; /* skip \n */
214 }
215 }
216 return NULL;
217}
218
219/* Extract a quoted string value from position. Handles both "..." and '...'
220 * Returns heap-allocated string, or NULL. */

Callers 5

parse_go_modFunction · 0.85
parse_cargo_tomlFunction · 0.85
parse_pyproject_tomlFunction · 0.85
parse_build_gradleFunction · 0.85
parse_mix_exsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected