src/platform_windows.cpp
changeset 82 d0ad5655688a
parent 80 b12ce95403a1
child 107 fbef1c59da96
     1.1 --- a/src/platform_windows.cpp	Sun Mar 01 15:32:16 2015 +0100
     1.2 +++ b/src/platform_windows.cpp	Sun Mar 01 21:51:53 2015 +0100
     1.3 @@ -203,9 +203,15 @@
     1.4      return (long) (r & ((1<<31)-1));
     1.5  }
     1.6  
     1.7 -#ifndef strtok_r
     1.8 -#define strtok_r(A, B, C) strtok_s((A), (B), (C))
     1.9 -#endif
    1.10 +char *strndup(const char *s1, size_t n)
    1.11 +{
    1.12 +    char *str = (char *) calloc(n + 1, 1);
    1.13 +    if (str == NULL)
    1.14 +        return NULL;
    1.15 +
    1.16 +    strncpy(str, s1, n);
    1.17 +    return str;
    1.18 +}
    1.19  
    1.20  } // "C"
    1.21