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

Function url_at

internal/cbm/doc_pdf.c:388–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388static int url_at(const uint32_t *t, int n, int p, url_cache_t *uc) {
389 if (lit_at(t, n, p, "https://") || lit_at(t, n, p, "http://") || lit_at(t, n, p, "ftp://") ||
390 lit_at(t, n, p, "file://")) {
391 int q = p;
392 while (t[q] != '/') {
393 q++;
394 }
395 q += 2;
396 if (q < n && !pdf_u_space(t[q])) {
397 return run_end_from(t, n, q);
398 }
399 }
400 if (lit_at(t, n, p, "www.") && p + 4 < n && !pdf_u_space(t[p + 4])) {
401 return run_end_from(t, n, p + 4);
402 }
403 if (pdf_u_space(t[p])) {
404 return -1;
405 }
406 url_cache_run(t, n, p, uc);
407 if (uc->at > p) {
408 return uc->at_end;
409 }
410 return -1;
411}
412
413/* PATH_RE's body after the optional prefix: (?:[seg]+/)+[tail]*[end] */
414static int path_body(const uint32_t *t, int n, int q) {

Callers 1

candidatesFunction · 0.85

Calls 4

lit_atFunction · 0.85
pdf_u_spaceFunction · 0.85
run_end_fromFunction · 0.85
url_cache_runFunction · 0.85

Tested by

no test coverage detected