Language detected for a discovered file by relative path, or CBM_LANG_COUNT * if the file was not indexed. */
| 1441 | /* Language detected for a discovered file by relative path, or CBM_LANG_COUNT |
| 1442 | * if the file was not indexed. */ |
| 1443 | static CBMLanguage discover_lang_of(const cbm_file_info_t *files, int count, const char *rel) { |
| 1444 | for (int i = 0; i < count; i++) { |
| 1445 | if (strcmp(files[i].rel_path, rel) == 0) { |
| 1446 | return files[i].language; |
| 1447 | } |
| 1448 | } |
| 1449 | return CBM_LANG_COUNT; |
| 1450 | } |
| 1451 | |
| 1452 | /* Write raw bytes (may contain embedded NUL) to base/rel. Parent must exist. */ |
| 1453 | static int write_bytes_file(const char *path, const void *data, size_t n) { |