Language detected for a discovered file by relative path, or CBM_LANG_COUNT * if the file was not indexed. */
| 2114 | /* Language detected for a discovered file by relative path, or CBM_LANG_COUNT |
| 2115 | * if the file was not indexed. */ |
| 2116 | static CBMLanguage discover_lang_of(const cbm_file_info_t *files, int count, const char *rel) { |
| 2117 | for (int i = 0; i < count; i++) { |
| 2118 | if (strcmp(files[i].rel_path, rel) == 0) { |
| 2119 | return files[i].language; |
| 2120 | } |
| 2121 | } |
| 2122 | return CBM_LANG_COUNT; |
| 2123 | } |
| 2124 | |
| 2125 | /* Write raw bytes (may contain embedded NUL) to base/rel. Parent must exist. */ |
| 2126 | static int write_bytes_file(const char *path, const void *data, size_t n) { |