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

Function pc_copy

tests/test_pipeline_conventions.c:61–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 return pc_path(path, sizeof(path), f->repo, leaf) && pc_write(path, text);
60}
61static bool pc_copy(const char *from, const char *to) {
62 FILE *a = cbm_fopen(from, "rb"), *b = cbm_fopen(to, "wb");
63 bool ok = a && b;
64 unsigned char bytes[4096];
65 while (ok) {
66 size_t n = fread(bytes, 1, sizeof(bytes), a);
67 if (n && fwrite(bytes, 1, n, b) != n) { ok = false; break; }
68 if (n < sizeof(bytes)) { ok = !ferror(a); break; }
69 }
70 if (a && fclose(a) != 0) ok = false;
71 if (b && fclose(b) != 0) ok = false;
72 return ok;
73}
74static bool pc_files_equal(const char *left, const char *right) {
75 FILE *a = cbm_fopen(left, "rb"), *b = cbm_fopen(right, "rb");
76 bool ok = a && b;

Callers 1

pc_snapshotFunction · 0.85

Calls 3

cbm_fopenFunction · 0.85
freadFunction · 0.85
fwriteFunction · 0.85

Tested by

no test coverage detected