| 1185 | } |
| 1186 | |
| 1187 | static bool rst_code_ext(const char *path) { |
| 1188 | const char *base = strrchr(path, '/'); |
| 1189 | base = base ? base + 1 : path; |
| 1190 | if (strncmp(base, "Makefile", strlen("Makefile")) == 0 || |
| 1191 | strncmp(base, "Kconfig", strlen("Kconfig")) == 0) { |
| 1192 | return true; |
| 1193 | } |
| 1194 | const char *dot = strrchr(base, '.'); |
| 1195 | if (!dot) { |
| 1196 | return false; |
| 1197 | } |
| 1198 | char ext[16]; |
| 1199 | size_t el = strlen(dot); |
| 1200 | if (el >= sizeof(ext)) { |
| 1201 | return false; |
| 1202 | } |
| 1203 | for (size_t i = 0; i <= el; i++) { |
| 1204 | char c = dot[i]; |
| 1205 | ext[i] = (char)(c >= 'A' && c <= 'Z' ? c + ('a' - 'A') : c); |
| 1206 | } |
| 1207 | return rst_in(ext, CODE_EXT); |
| 1208 | } |
| 1209 | |
| 1210 | static void rst_directive_tokens(rst_doc_t *d, const rst_dir_t *dir) { |
| 1211 | CBMArena *a = d->ctx->arena; |
no test coverage detected