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

Function ecell_url_path

internal/cbm/sqlite_writer.c:1599–1626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1597 safe_str(e->local_name), e->id, out_len);
1598}
1599static uint8_t *ecell_url_path(const CBMDumpEdge *e, int *out_len) {
1600 const char *url = (e->url_path && e->url_path[0] != '\0') ? e->url_path : NULL;
1601 RecordBuilder r;
1602 rec_init(&r);
1603 rec_add_text(&r, e->project);
1604 if (url) {
1605 rec_add_text(&r, url);
1606 } else {
1607 rec_add_null(&r);
1608 }
1609 rec_add_int(&r, e->id);
1610 int payload_len = 0;
1611 uint8_t *payload = rec_finalize(&r, &payload_len);
1612 rec_free(&r);
1613 int vlen = varint_len(payload_len);
1614 int total = vlen + payload_len;
1615 uint8_t *cell = (uint8_t *)malloc(total);
1616 if (!cell) {
1617 free(payload);
1618 *out_len = 0;
1619 return NULL;
1620 }
1621 int pos = put_varint(cell, payload_len);
1622 memcpy(cell + pos, payload, payload_len);
1623 free(payload);
1624 *out_len = total;
1625 return cell;
1626}
1627
1628/* Build an edge index from a pre-sorted permutation using a cell builder callback. */
1629static uint32_t build_edge_index_sorted(FILE *fp, uint32_t *next_page, CBMDumpEdge *edges,

Callers

nothing calls this directly

Calls 8

rec_initFunction · 0.85
rec_add_textFunction · 0.85
rec_add_nullFunction · 0.85
rec_add_intFunction · 0.85
rec_finalizeFunction · 0.85
rec_freeFunction · 0.85
varint_lenFunction · 0.85
put_varintFunction · 0.85

Tested by

no test coverage detected