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

Function read_test_file_alloc

tests/test_cli.c:419–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419static char *read_test_file_alloc(const char *path) {
420 FILE *f = fopen(path, "rb");
421 if (!f)
422 return NULL;
423 if (fseek(f, 0, SEEK_END) != 0) {
424 fclose(f);
425 return NULL;
426 }
427 long len = ftell(f);
428 if (len < 0 || fseek(f, 0, SEEK_SET) != 0) {
429 fclose(f);
430 return NULL;
431 }
432 char *buf = malloc((size_t)len + 1);
433 if (!buf) {
434 fclose(f);
435 return NULL;
436 }
437 size_t read_len = fread(buf, 1, (size_t)len, f);
438 fclose(f);
439 if (read_len != (size_t)len) {
440 free(buf);
441 return NULL;
442 }
443 buf[read_len] = '\0';
444 return buf;
445}
446
447static bool test_file_contains_all(const char *path, const char *const *tokens,
448 size_t token_count) {

Callers 4

test_file_contains_allFunction · 0.85
test_cli.cFile · 0.85
openhands_read_docFunction · 0.85
openhands_file_equalsFunction · 0.85

Calls 2

fopenFunction · 0.85
freadFunction · 0.85

Tested by

no test coverage detected