From bb6266ad99efe5f97667072fdd52437234e94768 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 14 Jun 2020 22:49:36 +0000 Subject: Give the fts_compar struct member a real prototype. This adds clarity and avoids compiler warnings. --- compat_fts.c | 5 ++++- compat_fts.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/compat_fts.c b/compat_fts.c index 87847927..01577f50 100644 --- a/compat_fts.c +++ b/compat_fts.c @@ -62,6 +62,8 @@ static int fts_palloc(FTS *, size_t); static FTSENT *fts_sort(FTS *, FTSENT *, int); static unsigned short fts_stat(FTS *, FTSENT *); +typedef int (*qsort_compar_proto)(const void *, const void *); + #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) #ifndef O_CLOEXEC #define O_CLOEXEC 0 @@ -585,7 +587,8 @@ fts_sort(FTS *sp, FTSENT *head, int nitems) } for (ap = sp->fts_array, p = head; p; p = p->fts_link) *ap++ = p; - qsort(sp->fts_array, nitems, sizeof(FTSENT *), sp->fts_compar); + qsort(sp->fts_array, nitems, sizeof(FTSENT *), + (qsort_compar_proto)sp->fts_compar); for (head = *(ap = sp->fts_array); --nitems; ++ap) ap[0]->fts_link = ap[1]; ap[0]->fts_link = NULL; diff --git a/compat_fts.h b/compat_fts.h index f4a97a4c..ca3f3a7e 100644 --- a/compat_fts.h +++ b/compat_fts.h @@ -43,7 +43,8 @@ typedef struct { char *fts_path; /* path for this descent */ size_t fts_pathlen; /* sizeof(path) */ int fts_nitems; /* elements in the sort array */ - int (*fts_compar)(); /* compare function */ + int (*fts_compar)(const struct _ftsent **, const struct _ftsent **); + /* compare function */ #define FTS_NOCHDIR 0x0004 /* don't change directories */ #define FTS_PHYSICAL 0x0010 /* physical walk */ -- cgit