source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Give the fts_compar struct member a real prototype.
@ 2020-06-14 22:50 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2020-06-14 22:50 UTC (permalink / raw)
  To: source

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-14 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14 22:50 mandoc: Give the fts_compar struct member a real prototype schwarze

source@mandoc.bsd.lv

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/mandoc-source

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 mandoc-source mandoc-source/ http://inbox.vuxu.org/mandoc-source \
		source@mandoc.bsd.lv
	public-inbox-index mandoc-source

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git