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