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

Function ri_write_big

tests/test_index_resilience.c:50–65  ·  view source on GitHub ↗

Write a comment-only python file padded well past `bytes`. The file is never * parsed (the size cap rejects it before extraction), so its content only needs * to make it a discoverable .py source that exceeds the cap. */

Source from the content-addressed store, hash-verified

48 * parsed (the size cap rejects it before extraction), so its content only needs
49 * to make it a discoverable .py source that exceeds the cap. */
50static void ri_write_big(const char *dir, const char *name, size_t bytes) {
51 char path[700];
52 snprintf(path, sizeof(path), "%s/%s", dir, name);
53 FILE *f = fopen(path, "wb");
54 if (!f) {
55 return;
56 }
57 static const char line[] = "# oversized filler line padding this file past the size cap\n";
58 size_t linelen = sizeof(line) - 1;
59 size_t written = 0;
60 while (written < bytes) {
61 fwrite(line, 1, linelen, f);
62 written += linelen;
63 }
64 fclose(f);
65}
66
67/* Slurp a whole file into a heap buffer (NUL-terminated). NULL on error. */
68static char *ri_slurp(const char *path) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected