| 965 | } |
| 966 | |
| 967 | static void sphinx_add(sphinx_suffixes_t *out, const char *s, size_t n) { |
| 968 | if (n < PAIR_LEN || n >= SPHINX_SUFFIX_LEN || s[0] != '.' || out->count >= SPHINX_SUFFIXES || |
| 969 | (n == strlen(".rst") && memcmp(s, ".rst", n) == 0)) { |
| 970 | return; |
| 971 | } |
| 972 | for (size_t i = SKIP_ONE; i < n; i++) { |
| 973 | if (!isalnum((unsigned char)s[i]) && s[i] != '_' && s[i] != '-') { |
| 974 | return; |
| 975 | } |
| 976 | } |
| 977 | memcpy(out->ext[out->count], s, n); |
| 978 | out->ext[out->count][n] = '\0'; |
| 979 | out->count++; |
| 980 | } |
| 981 | |
| 982 | /* `source_suffix = '.txt'`, `= ['.rst', '.txt']` or |
| 983 | * `= {'.rst': 'restructuredtext', '.txt': 'restructuredtext'}` (a dict |