i965: Enable GL_ARB_ES3_1_compatibility on Gen8+ if CS are available.
[mesa.git] / src / util / strndup.c
index 2c24d3789c2fd99fa974d9f2bb58dfde6387784f..5ceb32fe4743d0d46f0453efb6dae69964190922 100644 (file)
@@ -23,6 +23,7 @@
 
 #if defined(_WIN32)
 #include <stdlib.h>
+#include <string.h>
 #include "strndup.h"
 
 char *
@@ -34,10 +35,7 @@ strndup(const char *str, size_t max)
    if (!str)
       return NULL;
 
-   n = strlen(str);
-   if (n > max)
-      n = max;
-
+   n = strnlen(str, max);
    ptr = (char *) calloc(n + 1, sizeof(char));
    if (!ptr)
       return NULL;