summaryrefslogtreecommitdiff
path: root/test/stdlib/qsort.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-23 13:27:05 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-23 13:27:05 +0200
commit05c69924b14d68027a90695a4d8da4ec70c9a886 (patch)
treeec4e39d49ea7758366dd6a8dc325f5965f1ba2af /test/stdlib/qsort.c
parenta9e2101d71d1d007bf8dec492bb6743cb58e2537 (diff)
testsuite: fix one bug, one warning; extend README (one TODO added)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'test/stdlib/qsort.c')
-rw-r--r--test/stdlib/qsort.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/stdlib/qsort.c b/test/stdlib/qsort.c
index abc505e2d..74f93315f 100644
--- a/test/stdlib/qsort.c
+++ b/test/stdlib/qsort.c
@@ -34,7 +34,15 @@ int main(void)
printf("[%d] %s\n", i, dirbuf->d_name);
}
printf("\nCalling qsort()\n");
- qsort(array, numdir, sizeof(struct dirent *), alphasort);
+ /* Even though some manpages say that alphasort should be
+ * int alphasort(const void *a, const void *b),
+ * in reality glibc and uclibc have const struct dirent**
+ * instead of const void*.
+ * Therefore we get a warning here unless we use a cast,
+ * which makes people think that alphasort prototype
+ * needs to be fixed in uclibc headers.
+ */
+ qsort(array, numdir, sizeof(struct dirent *), (void*) alphasort);
for (i = 0; i < numdir; ++i) {
dirbuf = array[i];
printf("[%d] %s\n", i, dirbuf->d_name);