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

Function tir_render

src/mcp/test_impact_result_json.c:239–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237}
238
239bool tir_render(tir_context *c, tir_json *node, char **bytes, size_t *length, bool output) {
240 uint64_t bound = UINT64_MAX / 8;
241 size_t limit = bound < SIZE_MAX - 1 ? (size_t)bound : SIZE_MAX - 1;
242 if (output && c->limits->max_output_bytes < limit)
243 limit = c->limits->max_output_bytes;
244 tir_writer measure = {c, NULL, 0, limit};
245 if (!tir_write_node(&measure, node))
246 return false;
247 char *data = tir_alloc(c, measure.used + 1, 1);
248 if (!data)
249 return false;
250 tir_writer writer = {c, data, 0, measure.used};
251 if (!tir_write_node(&writer, node))
252 return false;
253 *bytes = data;
254 *length = writer.used;
255 return true;
256}
257
258static bool tir_hash_part(tir_context *c, cbm_sha256_ctx *hash, tir_bytes bytes) {
259 size_t length = bytes.length;

Callers 1

tir_build_wireFunction · 0.85

Calls 2

tir_write_nodeFunction · 0.85
tir_allocFunction · 0.85

Tested by

no test coverage detected