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

Function tf_only_add_file

tests/test_main.c:947–971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

945}
946
947static bool tf_only_add_file(const char *path) {
948 FILE *file = cbm_fopen(path, "r");
949 if (!file) {
950 fprintf(stderr, "cannot read test selection file: %s\n", path);
951 return false;
952 }
953 char line[CBM_SZ_1K];
954 bool ok = true;
955 while (ok && fgets(line, sizeof(line), file)) {
956 size_t length = strlen(line);
957 if (length == sizeof(line) - 1 && line[length - 1] != '\n') {
958 /* The rest of the line would be read back as a token of its own. */
959 fprintf(stderr, "test selection file line too long: %s\n", path);
960 ok = false;
961 } else {
962 ok = tf_only_add(line, strcspn(line, "#\n"));
963 }
964 }
965 if (ok && ferror(file)) {
966 fprintf(stderr, "cannot read test selection file: %s\n", path);
967 ok = false;
968 }
969 (void)fclose(file);
970 return ok;
971}
972
973static int tf_only_compare(const void *left, const void *right) {
974 const tf_only_token_t *a = left;

Callers 1

tf_only_initFunction · 0.85

Calls 2

cbm_fopenFunction · 0.85
tf_only_addFunction · 0.85

Tested by

no test coverage detected