Get lowercase file extension from path */
| 3624 | |
| 3625 | /* Get lowercase file extension from path */ |
| 3626 | static const char *file_ext(const char *path) { |
| 3627 | if (!path) { |
| 3628 | return NULL; |
| 3629 | } |
| 3630 | const char *dot = strrchr(path, '.'); |
| 3631 | if (!dot) { |
| 3632 | return NULL; |
| 3633 | } |
| 3634 | static CBM_TLS char buf[CBM_SZ_16]; |
| 3635 | int len = (int)strlen(dot); |
| 3636 | if (len >= (int)sizeof(buf)) { |
| 3637 | return NULL; |
| 3638 | } |
| 3639 | for (int i = 0; i < len; i++) { |
| 3640 | buf[i] = (char)((dot[i] >= 'A' && dot[i] <= 'Z') ? dot[i] + CBM_SZ_32 : dot[i]); |
| 3641 | } |
| 3642 | buf[len] = '\0'; |
| 3643 | return buf; |
| 3644 | } |
| 3645 | |
| 3646 | /* ── Architecture aspect implementations ───────────────────────── */ |
| 3647 |