summaryrefslogtreecommitdiff
path: root/libc/misc/dirent
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/dirent')
-rw-r--r--libc/misc/dirent/alphasort.c7
-rw-r--r--libc/misc/dirent/alphasort64.c7
-rw-r--r--libc/misc/dirent/scandir.c10
-rw-r--r--libc/misc/dirent/scandir64.c10
-rw-r--r--libc/misc/dirent/versionsort.c5
-rw-r--r--libc/misc/dirent/versionsort64.c5
6 files changed, 12 insertions, 32 deletions
diff --git a/libc/misc/dirent/alphasort.c b/libc/misc/dirent/alphasort.c
index 70aa2a516..eb0dbf238 100644
--- a/libc/misc/dirent/alphasort.c
+++ b/libc/misc/dirent/alphasort.c
@@ -8,11 +8,8 @@
#include <string.h>
#include "dirstream.h"
-/* Experimentally off - libc_hidden_proto(strcmp) */
-
-int alphasort(const void * a, const void * b)
+int alphasort(const struct dirent **a, const struct dirent **b)
{
- return strcmp ((*(const struct dirent **) a)->d_name,
- (*(const struct dirent **) b)->d_name);
+ return strcmp((*a)->d_name, (*b)->d_name);
}
diff --git a/libc/misc/dirent/alphasort64.c b/libc/misc/dirent/alphasort64.c
index de7a87a9a..d65b59647 100644
--- a/libc/misc/dirent/alphasort64.c
+++ b/libc/misc/dirent/alphasort64.c
@@ -10,10 +10,7 @@
#include <string.h>
#include "dirstream.h"
-/* Experimentally off - libc_hidden_proto(strcmp) */
-
-int alphasort64(const void * a, const void * b)
+int alphasort64(const struct dirent64 **a, const struct dirent64 **b)
{
- return strcmp ((*(const struct dirent64 **) a)->d_name,
- (*(const struct dirent64 **) b)->d_name);
+ return strcmp((*a)->d_name, (*b)->d_name);
}
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;
}
diff --git a/libc/misc/dirent/scandir64.c b/libc/misc/dirent/scandir64.c
index bbd452d50..3d2a250a4 100644
--- a/libc/misc/dirent/scandir64.c
+++ b/libc/misc/dirent/scandir64.c
@@ -30,15 +30,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(readdir64) */
-
int scandir64(const char *dir, struct dirent64 ***namelist,
int (*selector) (const struct dirent64 *),
- int (*compar) (const void *, const void *))
+ int (*compar) (const struct dirent64 **, const struct dirent64 **))
{
DIR *dp = opendir (dir);
struct dirent64 *current;
@@ -111,7 +105,7 @@ int scandir64(const char *dir, struct dirent64 ***namelist,
/* Sort the list if we have a comparison function to sort with. */
if (compar != NULL)
- qsort (names, pos, sizeof (struct dirent64 *), compar);
+ qsort (names, pos, sizeof (struct dirent64 *), (comparison_fn_t) compar);
*namelist = names;
return pos;
}
diff --git a/libc/misc/dirent/versionsort.c b/libc/misc/dirent/versionsort.c
index 53476e67f..d84da1f6c 100644
--- a/libc/misc/dirent/versionsort.c
+++ b/libc/misc/dirent/versionsort.c
@@ -8,8 +8,7 @@
#include <string.h>
#include "dirstream.h"
-int versionsort(const void *a, const void *b)
+int versionsort(const struct dirent **a, const struct dirent **b)
{
- return strverscmp((*(const struct dirent **) a)->d_name,
- (*(const struct dirent **) b)->d_name);
+ return strverscmp((*a)->d_name, (*b)->d_name);
}
diff --git a/libc/misc/dirent/versionsort64.c b/libc/misc/dirent/versionsort64.c
index 684a46283..af9689eab 100644
--- a/libc/misc/dirent/versionsort64.c
+++ b/libc/misc/dirent/versionsort64.c
@@ -10,8 +10,7 @@
#include <string.h>
#include "dirstream.h"
-int versionsort64(const void *a, const void *b)
+int versionsort64(const struct dirent64 **a, const struct dirent64 **b)
{
- return strverscmp((*(const struct dirent64 **) a)->d_name,
- (*(const struct dirent64 **) b)->d_name);
+ return strverscmp((*a)->d_name, (*b)->d_name);
}