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

Function ecell_url_path

internal/cbm/sqlite_writer.c:1578–1605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1576 safe_str(e->local_name), e->id, out_len);
1577}
1578static uint8_t *ecell_url_path(const CBMDumpEdge *e, int *out_len) {
1579 const char *url = (e->url_path && e->url_path[0] != '\0') ? e->url_path : NULL;
1580 RecordBuilder r;
1581 rec_init(&r);
1582 rec_add_text(&r, e->project);
1583 if (url) {
1584 rec_add_text(&r, url);
1585 } else {
1586 rec_add_null(&r);
1587 }
1588 rec_add_int(&r, e->id);
1589 int payload_len = 0;
1590 uint8_t *payload = rec_finalize(&r, &payload_len);
1591 rec_free(&r);
1592 int vlen = varint_len(payload_len);
1593 int total = vlen + payload_len;
1594 uint8_t *cell = (uint8_t *)malloc(total);
1595 if (!cell) {
1596 free(payload);
1597 *out_len = 0;
1598 return NULL;
1599 }
1600 int pos = put_varint(cell, payload_len);
1601 memcpy(cell + pos, payload, payload_len);
1602 free(payload);
1603 *out_len = total;
1604 return cell;
1605}
1606
1607/* Build an edge index from a pre-sorted permutation using a cell builder callback. */
1608static 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