From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Give the fts_compar struct member a real prototype.
Date: Sun, 14 Jun 2020 17:50:07 -0500 (EST) [thread overview]
Message-ID: <490dd1db92f39dc7@mandoc.bsd.lv> (raw)
Log Message:
-----------
Give the fts_compar struct member a real prototype.
This adds clarity and avoids compiler warnings.
Modified Files:
--------------
mandoc:
compat_fts.h
compat_fts.c
Revision Data
-------------
Index: compat_fts.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_fts.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lcompat_fts.c -Lcompat_fts.c -u -p -r1.14 -r1.15
--- compat_fts.c
+++ 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 nite
}
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;
Index: compat_fts.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/compat_fts.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -Lcompat_fts.h -Lcompat_fts.h -u -p -r1.4 -r1.5
--- compat_fts.h
+++ 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 */
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
reply other threads:[~2020-06-14 22:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=490dd1db92f39dc7@mandoc.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).