Get lowercase file extension from path */
| 5648 | |
| 5649 | /* Get lowercase file extension from path */ |
| 5650 | static const char *file_ext(const char *path) { |
| 5651 | if (!path) { |
| 5652 | return NULL; |
| 5653 | } |
| 5654 | const char *dot = strrchr(path, '.'); |
| 5655 | if (!dot) { |
| 5656 | return NULL; |
| 5657 | } |
| 5658 | static CBM_TLS char buf[CBM_SZ_16]; |
| 5659 | int len = (int)strlen(dot); |
| 5660 | if (len >= (int)sizeof(buf)) { |
| 5661 | return NULL; |
| 5662 | } |
| 5663 | for (int i = 0; i < len; i++) { |
| 5664 | buf[i] = (char)((dot[i] >= 'A' && dot[i] <= 'Z') ? dot[i] + CBM_SZ_32 : dot[i]); |
| 5665 | } |
| 5666 | buf[len] = '\0'; |
| 5667 | return buf; |
| 5668 | } |
| 5669 | |
| 5670 | /* ── Architecture aspect implementations ───────────────────────── */ |
| 5671 |