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

Function emit

internal/cbm/doc_pdf.c:985–1007  ·  view source on GitHub ↗

Push a token; returns its index in the file's token array, or -1. */

Source from the content-addressed store, hash-verified

983
984/* Push a token; returns its index in the file's token array, or -1. */
985static int emit(pdf_emit_t *e, int syntax, const char *raw, uint32_t line, uint16_t flags) {
986 CBMArena *a = e->ctx->arena;
987 char *r = cbm_arena_strdup(a, raw);
988 if (!r) {
989 e->failed = true;
990 return -1;
991 }
992 CBMDocLink link = {
993 .source_qn = e->page_qn,
994 .raw = r,
995 .line = line,
996 .def_line = e->page,
997 .syntax = (uint16_t)syntax,
998 .flags = flags,
999 };
1000 int idx = e->ctx->result->doc_links.count;
1001 cbm_doclinks_push(&e->ctx->result->doc_links, a, link);
1002 if (e->ctx->result->doc_links.count != idx + 1) {
1003 e->failed = true;
1004 return -1;
1005 }
1006 return idx;
1007}
1008
1009typedef struct {
1010 char *p;

Callers 1

scan_pageFunction · 0.70

Calls 2

cbm_doclinks_pushFunction · 0.85
cbm_arena_strdupFunction · 0.70

Tested by

no test coverage detected