summaryrefslogtreecommitdiff
path: root/libc/misc/dirent/scandir.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-07-20 13:19:36 -0400
committerMike Frysinger <vapier@gentoo.org>2009-07-20 13:19:36 -0400
commit75552ab845005d5b386d4c1383d9c10193168847 (patch)
treef2cbce375f646a4609ffc76660f5f90b97868aa6 /libc/misc/dirent/scandir.c
parent41ea9da89530817441761dfc1f3c716c17d7ccb4 (diff)
dirent: push dirent type to prototypes
This syncs the dirent related functions with the glibc behavior -- rather than take void pointers everywhere, make the struct dirent pointers explicit in the API. After all, the functions themselves will cast the pointers to a dirent structure, so if it isn't as expected, people will crash. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libc/misc/dirent/scandir.c')
-rw-r--r--libc/misc/dirent/scandir.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libc/misc/dirent/scandir.c b/libc/misc/dirent/scandir.c
index 9f1055439..bb425648b 100644
--- a/libc/misc/dirent/scandir.c
+++ b/libc/misc/dirent/scandir.c
@@ -12,15 +12,9 @@
#include <sys/types.h>
#include "dirstream.h"
-/* Experimentally off - libc_hidden_proto(memcpy) */
-/* libc_hidden_proto(opendir) */
-/* libc_hidden_proto(closedir) */
-/* libc_hidden_proto(qsort) */
-/* libc_hidden_proto(readdir) */
-
int scandir(const char *dir, struct dirent ***namelist,
int (*selector) (const struct dirent *),
- int (*compar) (const void *, const void *))
+ int (*compar) (const struct dirent **, const struct dirent **))
{
DIR *dp = opendir (dir);
struct dirent *current;
@@ -94,7 +88,7 @@ int scandir(const char *dir, struct dirent ***namelist,
/* Sort the list if we have a comparison function to sort with. */
if (compar != NULL)
- qsort (names, pos, sizeof (struct dirent *), compar);
+ qsort (names, pos, sizeof (struct dirent *), (comparison_fn_t) compar);
*namelist = names;
return pos;
}