Helper functions for building compile commands
| 1442 | } |
| 1443 | } else { |
| 1444 | free(unescaped); |
| 1445 | } |
| 1446 | } |
| 1447 | start = end; |
| 1448 | while (*start && (*start == ' ' || *start == '\t')) start++; |
| 1449 | } |
| 1450 | free(all_deps); |
| 1451 | } |
| 1452 | |
| 1453 | return deps; |
| 1454 | } |
| 1455 | |
| 1456 | // Rebuild check functions |
| 1457 | StringVector parseDependencies(const char* depFilePath, const char* baseDir) { |
| 1458 | FILE* file = FileSystem_open(depFilePath, "r"); |
| 1459 | if (!file) { |
| 1460 | StringVector empty; |
| 1461 | StringVector_init(&empty, 0); |
| 1462 | return empty; |
| 1463 | } |
| 1464 | |
| 1465 | StringVector deps; |
| 1466 | int isJson = strstr(depFilePath, ".json") != NULL; |
| 1467 | if (isJson) { |
| 1468 | deps = parseJsonDependencies(file); |
| 1469 | } else { |
| 1470 | deps = parseMakeDependencies(file, baseDir); |
| 1471 | } |
| 1472 | if (printMessages) { |
| 1473 | printf("- Found %zu dependencies for \"%s\"\n", deps.count, depFilePath); |
| 1474 | for (size_t i = 0; i < deps.count && i < 10; ++i) { |
| 1475 | printf(" Dep %zu: %s\n", i, deps.data[i]); |
| 1476 | } |
| 1477 | if (deps.count > 10) printf(" ... and %zu more\n", deps.count - 10); |
| 1478 | } |
| 1479 | for (size_t i = 0; i < deps.count; ++i) { |
| 1480 | char* dep = deps.data[i]; |
no test coverage detected