diff --git a/source4/dsdb/samdb/ldb_modules/count_attrs.c b/source4/dsdb/samdb/ldb_modules/count_attrs.c
index b0d1b22..29f1b94 100644
--- a/source4/dsdb/samdb/ldb_modules/count_attrs.c
+++ b/source4/dsdb/samdb/ldb_modules/count_attrs.c
@@ -222,7 +222,7 @@ static const char **get_sorted_attrs(TALLOC_CTX *mem_ctx,
 		attrs[i] = a;
 	}
 
-	qsort(attrs, n_attrs, sizeof(char *), (__compar_fn_t)strcasecmp_ptr);
+	qsort(attrs, n_attrs, sizeof(char *), (int (*)(const void *, const void *))strcasecmp_ptr);
 	return attrs;
 }
 
@@ -313,7 +313,7 @@ static int count_attrs_search_callback(struct ldb_request *req,
 			}
 
 			qsort(found_attrs, msg->num_elements, sizeof(char *),
-			      (__compar_fn_t)strcasecmp_ptr);
+			      (int (*)(const void *, const void *))strcasecmp_ptr);
 
 
 			/* find and report duplicates */
