i965: Enable GL_ARB_ES3_1_compatibility on Gen8+ if CS are available.
[mesa.git] / src / util / strndup.c
index ca1c6f53b575bb5e722944c568952c08df9680cd..5ceb32fe4743d0d46f0453efb6dae69964190922 100644 (file)
@@ -35,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;