svn commit: r288098 - head/lib/libc/gen
Craig Rodrigues
rodrigc at FreeBSD.org
Tue Sep 22 07:40:56 UTC 2015
Author: rodrigc
Date: Tue Sep 22 07:40:55 2015
New Revision: 288098
URL: https://svnweb.freebsd.org/changeset/base/288098
Log:
Use proper function prototype for readdir().
Eliminates -Wstrict-prototypes warning
Submitted by: Joerg Sonnenberger <joerg at dragonflybsd.org>
Obtained from: DragonFlyBSD (commit 2a6aec8dab58c89961cabcfdb92e0d0ae256dea4)
Modified:
head/lib/libc/gen/glob.c
Modified: head/lib/libc/gen/glob.c
==============================================================================
--- head/lib/libc/gen/glob.c Tue Sep 22 07:31:40 2015 (r288097)
+++ head/lib/libc/gen/glob.c Tue Sep 22 07:40:55 2015 (r288098)
@@ -650,13 +650,7 @@ glob3(Char *pathbuf, Char *pathend, Char
int err;
char buf[MAXPATHLEN];
- /*
- * The readdirfunc declaration can't be prototyped, because it is
- * assigned, below, to two functions which are prototyped in glob.h
- * and dirent.h as taking pointers to differently typed opaque
- * structures.
- */
- struct dirent *(*readdirfunc)();
+ struct dirent *(*readdirfunc)(DIR *);
if (pathend > pathend_last)
return (GLOB_ABORTED);
@@ -677,12 +671,14 @@ glob3(Char *pathbuf, Char *pathend, Char
err = 0;
- /* Search directory for matching names. */
+ /* pglob->gl_readdir takes a void *, fix this manually */
if (pglob->gl_flags & GLOB_ALTDIRFUNC)
- readdirfunc = pglob->gl_readdir;
+ readdirfunc = (struct dirent *(*)(DIR *))pglob->gl_readdir;
else
readdirfunc = readdir;
- while ((dp = (*readdirfunc)(dirp))) {
+
+ /* Search directory for matching names. */
+ while ((dp = (*readdirfunc)(dirp)) != NULL) {
char *sc;
Char *dc;
wchar_t wc;
More information about the svn-src-head
mailing list