| 21 | |
| 22 | #ifdef _WIN32 |
| 23 | char *cbm_strndup(const char *s, size_t n) { |
| 24 | if (!s) { |
| 25 | return NULL; |
| 26 | } |
| 27 | size_t len = 0; |
| 28 | while (len < n && s[len]) { |
| 29 | len++; |
| 30 | } |
| 31 | char *d = (char *)malloc(len + SKIP_ONE); |
| 32 | if (d) { |
| 33 | memcpy(d, s, len); |
| 34 | d[len] = '\0'; |
| 35 | } |
| 36 | return d; |
| 37 | } |
| 38 | #endif |
| 39 | |
| 40 | /* ── strcasestr (Windows lacks it) ────────────────────────────── */ |
no outgoing calls