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

Function ri_write_big

tests/test_index_resilience.c:38–53  ·  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

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

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected