summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorPhilip Guenthe <guenther@cvs.openbsd.org>2012-03-22 01:44:20 +0000
committerPhilip Guenthe <guenther@cvs.openbsd.org>2012-03-22 01:44:20 +0000
commit2e2475e8d275a770779144663fee23b401a6ce13 (patch)
tree5a88ea7fc8280d284edc70b122ae860aee8515d7 /lib/libc
parent28b53b23fb896b2ac25241cc161d67f65b88b054 (diff)
Update alphasort() and scandir()'s argument types to match POSIX:
use "const struct dirent **" instead of "const void *". Also, add __restrict to readdir_r(). ok matthew@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/scandir.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
index 2ad8c3e612e..b2b08a64c82 100644
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scandir.c,v 1.12 2007/09/02 15:19:16 deraadt Exp $ */
+/* $OpenBSD: scandir.c,v 1.13 2012/03/22 01:44:19 guenther Exp $ */
/*
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
@@ -56,7 +56,8 @@
int
scandir(const char *dirname, struct dirent ***namelist,
- int (*select)(struct dirent *), int (*dcomp)(const void *, const void *))
+ int (*select)(struct dirent *),
+ int (*dcomp)(const struct dirent **, const struct dirent **))
{
struct dirent *d, *p, **names = NULL;
size_t nitems = 0;
@@ -139,8 +140,7 @@ fail:
* Alphabetic order comparison routine for those who want it.
*/
int
-alphasort(const void *d1, const void *d2)
+alphasort(const struct dirent **d1, const struct dirent **d2)
{
- return(strcmp((*(struct dirent **)d1)->d_name,
- (*(struct dirent **)d2)->d_name));
+ return(strcmp((*d1)->d_name, (*d2)->d_name));
}