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

Function pf_files_equal

tests/test_pipeline_frozen.c:97–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 return fclose(file) == 0 && ok;
96}
97static bool pf_files_equal(const char *a, const char *b) {
98 FILE *left = cbm_fopen(a, "rb"), *right = cbm_fopen(b, "rb");
99 bool ok = left && right;
100 unsigned char x[4096], y[4096];
101 while (ok) {
102 size_t nx = fread(x, 1, sizeof(x), left), ny = fread(y, 1, sizeof(y), right);
103 if (nx != ny || memcmp(x, y, nx)) {
104 ok = false;
105 break;
106 }
107 if (nx < sizeof(x)) {
108 ok = !ferror(left) && !ferror(right);
109 break;
110 }
111 }
112 if (left && fclose(left))
113 ok = false;
114 if (right && fclose(right))
115 ok = false;
116 return ok;
117}
118static bool pf_directory_only(const char *directory, const char *allowed) {
119 cbm_dir_t *dir = cbm_opendir(directory);
120 if (!dir)

Callers 10

pf_builtin_controlFunction · 0.85
pf_hook_failureFunction · 0.85
pf_sidecar_refusalFunction · 0.85
pf_path_refusalFunction · 0.85
pf_cancel_failureFunction · 0.85
pf_rename_failureFunction · 0.85
pf_busy_retryFunction · 0.85
pf_diag_runFunction · 0.85

Calls 2

cbm_fopenFunction · 0.85
freadFunction · 0.85

Tested by

no test coverage detected