Get lowercase file extension from path */
| 5454 | |
| 5455 | /* Get lowercase file extension from path */ |
| 5456 | static const char *file_ext(const char *path) { |
| 5457 | if (!path) { |
| 5458 | return NULL; |
| 5459 | } |
| 5460 | const char *dot = strrchr(path, '.'); |
| 5461 | if (!dot) { |
| 5462 | return NULL; |
| 5463 | } |
| 5464 | static CBM_TLS char buf[CBM_SZ_16]; |
| 5465 | int len = (int)strlen(dot); |
| 5466 | if (len >= (int)sizeof(buf)) { |
| 5467 | return NULL; |
| 5468 | } |
| 5469 | for (int i = 0; i < len; i++) { |
| 5470 | buf[i] = (char)((dot[i] >= 'A' && dot[i] <= 'Z') ? dot[i] + CBM_SZ_32 : dot[i]); |
| 5471 | } |
| 5472 | buf[len] = '\0'; |
| 5473 | return buf; |
| 5474 | } |
| 5475 | |
| 5476 | /* ── Architecture aspect implementations ───────────────────────── */ |
| 5477 |