Browse Source

Fixed various warnings from build

References to qsort now use const void* in the
sorting function

Change-Id: Ieaf7b4db794e612a2e2c643424f1135750c75d77
Signed-off-by: Keith Poole <keith.poole@gmail.com>
Keith Poole 8 years ago
parent
commit
0d8aa4ec2a
66 changed files with 165 additions and 241 deletions
  1. 1 1
      sys/include/libc.h
  2. 1 1
      sys/src/9/amd64pv/devacpi.c
  3. 2 2
      sys/src/9/k10/devacpi.c
  4. 1 1
      sys/src/9/port/lib.h
  5. 2 3
      sys/src/ape/cmd/diff/dir.c
  6. 47 108
      sys/src/ape/cmd/pdksh/misc.c
  7. 1 1
      sys/src/ape/cmd/pdksh/proto.h
  8. 22 41
      sys/src/ape/cmd/pdksh/table.c
  9. 1 1
      sys/src/cmd/5i/stats.c
  10. 1 1
      sys/src/cmd/abaco/cols.c
  11. 1 1
      sys/src/cmd/acid/print.c
  12. 1 1
      sys/src/cmd/acme/cols.c
  13. 1 1
      sys/src/cmd/acme/fsys.c
  14. 1 1
      sys/src/cmd/acme/text.c
  15. 1 1
      sys/src/cmd/astro/astro.h
  16. 2 2
      sys/src/cmd/astro/dist.c
  17. 2 2
      sys/src/cmd/auth/secstore/dirls.c
  18. 1 1
      sys/src/cmd/auth/uniq.c
  19. 1 1
      sys/src/cmd/aux/acidleak.c
  20. 1 1
      sys/src/cmd/cec/cec.c
  21. 2 2
      sys/src/cmd/cwfs/con.c
  22. 1 1
      sys/src/cmd/cwfs/main.c
  23. 1 1
      sys/src/cmd/cwfs/uidgid.c
  24. 1 1
      sys/src/cmd/dict/dict.c
  25. 1 1
      sys/src/cmd/diff/diffdir.c
  26. 2 2
      sys/src/cmd/disk/exsort.c
  27. 2 2
      sys/src/cmd/disk/kfs/uid.c
  28. 1 1
      sys/src/cmd/fossil/cache.c
  29. 1 1
      sys/src/cmd/fossil/check.c
  30. 1 1
      sys/src/cmd/fossil/vac.c
  31. 2 2
      sys/src/cmd/grep/comp.c
  32. 1 1
      sys/src/cmd/grep/grep.h
  33. 1 1
      sys/src/cmd/ip/ftpd.c
  34. 2 2
      sys/src/cmd/ip/httpd/webls.c
  35. 1 1
      sys/src/cmd/ki/stats.c
  36. 1 1
      sys/src/cmd/kprof.c
  37. 3 3
      sys/src/cmd/ls.c
  38. 2 2
      sys/src/cmd/news.c
  39. 2 2
      sys/src/cmd/nm.c
  40. 1 1
      sys/src/cmd/nntpfs.c
  41. 1 1
      sys/src/cmd/prof.c
  42. 2 2
      sys/src/cmd/ps.c
  43. 1 1
      sys/src/cmd/qc/reg.c
  44. 1 1
      sys/src/cmd/qi/stats.c
  45. 1 1
      sys/src/cmd/ql/span.c
  46. 1 1
      sys/src/cmd/ratfs/ctlfiles.c
  47. 1 1
      sys/src/cmd/rc/glob.c
  48. 1 1
      sys/src/cmd/rdbfs.c
  49. 1 1
      sys/src/cmd/rio/fsys.c
  50. 1 1
      sys/src/cmd/scat/scat.c
  51. 6 1
      sys/src/cmd/sed.c
  52. 2 2
      sys/src/cmd/spell/pcode.c
  53. 0 1
      sys/src/cmd/tar.c
  54. 1 1
      sys/src/cmd/testalarm.c
  55. 1 1
      sys/src/cmd/time.c
  56. 1 0
      sys/src/cmd/touch.c
  57. 1 1
      sys/src/cmd/tprof.c
  58. 1 1
      sys/src/cmd/upas/fs/planb.c
  59. 1 1
      sys/src/cmd/upas/pop3/pop3.c
  60. 1 1
      sys/src/cmd/upas/smtp/mxdial.c
  61. 1 1
      sys/src/cmd/vi/stats.c
  62. 1 1
      sys/src/cmd/webcookies.c
  63. 3 3
      sys/src/cmd/webfs/cookies.c
  64. 2 2
      sys/src/libc/port/qsort.c
  65. 6 6
      sys/src/libmach/sym.c
  66. 6 6
      sys/src/libmemdraw/fillpoly.c

+ 1 - 1
sys/include/libc.h

@@ -394,7 +394,7 @@ extern	int	postnote(int, int, char *);
 extern	double	pow10(int);
 extern	int	putenv(char*, char*);
 extern	void	qsort(void*, int32_t, int32_t,
-				int (*)(void*, void*));
+				int (*)(const void*, const void*));
 extern	int	setjmp(jmp_buf);
 extern	double	strtod(char*, char**);
 extern	int32_t	strtol(char*, char**, int);

+ 1 - 1
sys/src/9/amd64pv/devacpi.c

@@ -785,7 +785,7 @@ dumpslit(Slit *sl)
 }
 
 static int
-cmpslitent(void* v1, void* v2)
+cmpslitent(const void* v1, const void* v2)
 {
 	SlEntry *se1, *se2;
 

+ 2 - 2
sys/src/9/k10/devacpi.c

@@ -785,9 +785,9 @@ dumpslit(Slit *sl)
 }
 
 static int
-cmpslitent(void* v1, void* v2)
+cmpslitent(const void* v1, const void* v2)
 {
-	SlEntry *se1, *se2;
+	const SlEntry *se1, *se2;
 
 	se1 = v1;
 	se2 = v2;

+ 1 - 1
sys/src/9/port/lib.h

@@ -191,7 +191,7 @@ extern	uint32_t	strtoul(char*, char**, int);
 extern	int64_t	strtoll(char*, char**, int);
 extern	uint64_t	strtoull(char*, char**, int);
 extern	void	qsort(void*, int32_t, int32_t,
-				int (*)(void*, void*));
+				int (*)(const void*, const void*));
 /*
  * Syscall data structures
  */

+ 2 - 3
sys/src/ape/cmd/diff/dir.c

@@ -39,7 +39,7 @@ struct dirdata
   char *data;	/* Allocated storage for file names.  */
 };
 
-static int compare_names PARAMS((void const *, void const *));
+static int compare_names PARAMS((const void *, const void *));
 static int dir_sort PARAMS((struct file_data const *, struct dirdata *));
 
 static int
@@ -134,8 +134,7 @@ dir_sort (dir, dirdata)
 /* Sort the files now in the table.  */
 
 static int
-compare_names (file1, file2)
-     void const *file1, *file2;
+compare_names (const void *file1, const void *file2)
 {
   return filename_cmp (* (char const *const *) file1,
 		       * (char const *const *) file2);

+ 47 - 108
sys/src/ape/cmd/pdksh/misc.c

@@ -32,11 +32,9 @@ static const unsigned char *cclass ARGS((const unsigned char *p, int sub));
  * Fast character classes
  */
 void
-setctypes(s, t)
-	register const char *s;
-	register int t;
+setctypes(const char *s, int t)
 {
-	register int i;
+	 int i;
 
 	if (t & C_IFS) {
 		for (i = 0; i < UCHAR_MAX+1; i++)
@@ -50,7 +48,7 @@ setctypes(s, t)
 void
 initctypes()
 {
-	register int c;
+	int c;
 
 	for (c = 'a'; c <= 'z'; c++)
 		ctypes[c] |= C_ALPHA;
@@ -69,11 +67,9 @@ initctypes()
 /* convert unsigned long to base N string */
 
 char *
-ulton(n, base)
-	register unsigned long n;
-	int base;
+ulton(unsigned long n, int base)
 {
-	register char *p;
+	char *p;
 	static char buf [20];
 
 	p = &buf[sizeof(buf)];
@@ -86,9 +82,7 @@ ulton(n, base)
 }
 
 char *
-str_save(s, ap)
-	register const char *s;
-	Area *ap;
+str_save(const char *s, Area *ap)
 {
 	return s ? strcpy((char*) alloc((size_t)strlen(s)+1, ap), s) : NULL;
 }
@@ -98,10 +92,7 @@ str_save(s, ap)
  * (unless n < 0).
  */
 char *
-str_nsave(s, n, ap)
-	register const char *s;
-	int n;
-	Area *ap;
+str_nsave(const char *s, int n, Area *ap)
 {
 	char *ns;
 
@@ -114,10 +105,7 @@ str_nsave(s, n, ap)
 
 /* called from expand.h:XcheckN() to grow buffer */
 char *
-Xcheck_grow_(xsp, xp, more)
-	XString *xsp;
-	char *xp;
-	int more;
+Xcheck_grow_(XString *xsp, char *xp, int more)
 {
 	char *old_beg = xsp->beg;
 
@@ -177,8 +165,7 @@ const struct option options[] = {
  * translate -o option into F* constant (also used for test -o option)
  */
 int
-option(n)
-	const char *n;
+option(const char *n)
 {
 	int i;
 
@@ -202,11 +189,7 @@ static void printoptions ARGS((int verbose));
 
 /* format a single select menu item */
 static char *
-options_fmt_entry(arg, i, buf, buflen)
-	void *arg;
-	int i;
-	char *buf;
-	int buflen;
+options_fmt_entry(void *arg, int i, char *buf, int buflen)
 {
 	struct options_info *oi = (struct options_info *) arg;
 
@@ -217,8 +200,7 @@ options_fmt_entry(arg, i, buf, buflen)
 }
 
 static void
-printoptions(verbose)
-	int verbose;
+printoptions(int verbose)
 {
 	int i;
 
@@ -254,7 +236,7 @@ getoptions()
 {
 	int i;
 	char m[(int) FNFLAGS + 1];
-	register char *cp = m;
+	 char *cp = m;
 
 	for (i = 0; i < NELEM(options); i++)
 		if (options[i].c && Flag(i))
@@ -265,10 +247,9 @@ getoptions()
 
 /* change a Flag(*) value; takes care of special actions */
 void
-change_flag(f, what, newval)
-	enum sh_flag f;	/* flag to change */
-	int what;	/* what is changing the flag (command line vs set) */
-	int newval;
+change_flag(enum sh_flag f,	/* flag to change */
+	int what,	/* what is changing the flag (command line vs set) */
+	int newval)
 {
 	int oldval;
 
@@ -298,10 +279,9 @@ change_flag(f, what, newval)
  * non-option arguments, -1 if there is an error.
  */
 int
-parse_args(argv, what, setargsp)
-	char **argv;
-	int	what;		/* OF_CMDLINE or OF_SET */
-	int	*setargsp;
+parse_args(char **argv,
+	int	what,		/* OF_CMDLINE or OF_SET */
+	int	*setargsp)
 {
 	static char cmd_opts[NELEM(options) + 3]; /* o:\0 */
 	static char set_opts[NELEM(options) + 5]; /* Ao;s\0 */
@@ -436,12 +416,10 @@ parse_args(argv, what, setargsp)
 
 /* parse a decimal number: returns 0 if string isn't a number, 1 otherwise */
 int
-getn(as, ai)
-	const char *as;
-	int *ai;
+getn(const char *as, int *ai)
 {
 	const char *s;
-	register int n;
+	 int n;
 	int sawdigit = 0;
 
 	s = as;
@@ -457,9 +435,7 @@ getn(as, ai)
 
 /* getn() that prints error */
 int
-bi_getn(as, ai)
-	const char *as;
-	int *ai;
+bi_getn(const char *as, int *ai)
 {
 	int rv = getn(as, ai);
 
@@ -479,9 +455,7 @@ bi_getn(as, ai)
  */
 
 int
-gmatch(s, p, isfile)
-	const char *s, *p;
-	int isfile;
+gmatch(const char *s, const char *p, int isfile)
 {
 	const char *se, *pe;
 
@@ -522,8 +496,7 @@ gmatch(s, p, isfile)
 - return ?
 */
 int
-has_globbing(xp, xpe)
-	const char *xp, *xpe;
+has_globbing(const char *xp, const char *xpe)
 {
 	const unsigned char *p = (const unsigned char *) xp;
 	const unsigned char *pe = (const unsigned char *) xpe;
@@ -577,12 +550,9 @@ has_globbing(xp, xpe)
 
 /* Function must return either 0 or 1 (assumed by code for 0x80|'!') */
 static int
-do_gmatch(s, se, p, pe, isfile)
-	const unsigned char *s, *p;
-	const unsigned char *se, *pe;
-	int isfile;
+do_gmatch(const unsigned char *s, const unsigned char *p, const unsigned char *se, const unsigned char *pe, int isfile;
 {
-	register int sc, pc;
+	int sc, pc;
 	const unsigned char *prest, *psub, *pnext;
 	const unsigned char *srest;
 
@@ -712,11 +682,9 @@ do_gmatch(s, se, p, pe, isfile)
 }
 
 static const unsigned char *
-cclass(p, sub)
-	const unsigned char *p;
-	register int sub;
+cclass(const unsigned char *p, int sub)
 {
-	register int c, d, not, found = 0;
+	 int c, d, not, found = 0;
 	const unsigned char *orig_p = p;
 
 	if ((not = (ISMAGIC(*p) && *++p == NOT)))
@@ -759,10 +727,7 @@ cclass(p, sub)
 
 /* Look for next ) or | (if match_sep) in *(foo|bar) pattern */
 const unsigned char *
-pat_scan(p, pe, match_sep)
-	const unsigned char *p;
-	const unsigned char *pe;
-	int match_sep;
+pat_scan(const unsigned char *p, const unsigned char *pe, int match_sep)
 {
 	int nest = 0;
 
@@ -784,31 +749,28 @@ pat_scan(p, pe, match_sep)
 /*
  * quick sort of array of generic pointers to objects.
  */
-static void qsort1 ARGS((void **base, void **lim, int (*f)(void *, void *)));
+static void qsort1 ARGS((void **base, void **lim, int (*f)(const void *, const void *)));
 
 void
-qsortp(base, n, f)
-	void **base;				/* base address */
-	size_t n;				/* elements */
-	int (*f) ARGS((void *, void *));	/* compare function */
+qsortp(void **base,				/* base address */
+	size_t n,				/* elements */
+	int (*f) ARGS((const void *, const void *)))	/* compare function */
 {
 	qsort1(base, base + n, f);
 }
 
 #define	swap2(a, b)	{\
-	register void *t; t = *(a); *(a) = *(b); *(b) = t;\
+	 void *t; t = *(a); *(a) = *(b); *(b) = t;\
 }
 #define	swap3(a, b, c)	{\
-	register void *t; t = *(a); *(a) = *(c); *(c) = *(b); *(b) = t;\
+	 void *t; t = *(a); *(a) = *(c); *(c) = *(b); *(b) = t;\
 }
 
 static void
-qsort1(base, lim, f)
-	void **base, **lim;
-	int (*f) ARGS((void *, void *));
+qsort1(void **base, void **lim, int (*f) ARGS((const void *, const void *)))
 {
-	register void **i, **j;
-	register void **lptr, **hptr;
+	 void **i, **j;
+	 void **lptr, **hptr;
 	size_t n;
 	int c;
 
@@ -874,17 +836,14 @@ qsort1(base, lim, f)
 }
 
 int
-xstrcmp(p1, p2)
-	void *p1, *p2;
+xstrcmp(const void *p1, const void *p2)
 {
 	return (strcmp((char *)p1, (char *)p2));
 }
 
 /* Initialize a Getopt structure */
 void
-ksh_getopt_reset(go, flags)
-	Getopt *go;
-	int flags;
+ksh_getopt_reset(Getopt *go, int flags)
 {
 	go->optind = 1;
 	go->optarg = (char *) 0;
@@ -920,10 +879,7 @@ ksh_getopt_reset(go, flags)
  *	  in go->info.
  */
 int
-ksh_getopt(argv, go, options)
-	char **argv;
-	Getopt *go;
-	const char *options;
+ksh_getopt(char **argv, Getopt *go, const char *options)
 {
 	char c;
 	char *o;
@@ -1023,8 +979,7 @@ ksh_getopt(argv, go, options)
  * No trailing newline is printed.
  */
 void
-print_value_quoted(s)
-	const char *s;
+print_value_quoted(const char *s)
 {
 	const char *p;
 	int inquote = 0;
@@ -1057,12 +1012,7 @@ print_value_quoted(s)
  * element
  */
 void
-print_columns(shf, n, func, arg, max_width)
-	struct shf *shf;
-	int n;
-	char *(*func) ARGS((void *, int, char *, int));
-	void *arg;
-	int max_width;
+print_columns(struct shf *shf, int n, char *(*func) ARGS((void *, int, char *, int)), void *arg, int max_width)
 {
 	char *str = (char *) alloc(max_width + 1, ATEMP);
 	int i;
@@ -1108,9 +1058,7 @@ print_columns(shf, n, func, arg, max_width)
 
 /* Strip any nul bytes from buf - returns new length (nbytes - # of nuls) */
 int
-strip_nuls(buf, nbytes)
-	char *buf;
-	int nbytes;
+strip_nuls(char *buf, int nbytes)
 {
 	char *dst;
 
@@ -1141,10 +1089,7 @@ strip_nuls(buf, nbytes)
  * Returns dst.
  */
 char *
-str_zcpy(dst, src, dsize)
-	char *dst;
-	const char *src;
-	int dsize;
+str_zcpy(char *dst, const char *src, int dsize)
 {
 	if (dsize > 0) {
 		int len = strlen(src);
@@ -1161,10 +1106,7 @@ str_zcpy(dst, src, dsize)
  * and restarts read.
  */
 int
-blocking_read(fd, buf, nbytes)
-	int fd;
-	char *buf;
-	int nbytes;
+blocking_read(int fd, char *buf, int nbytes)
 {
 	int ret;
 	int tried_reset = 0;
@@ -1193,8 +1135,7 @@ blocking_read(fd, buf, nbytes)
  * 1 if it was.
  */
 int
-reset_nonblock(fd)
-	int fd;
+reset_nonblock(int fd)
 {
 	int flags;
 	int blocking_flags;
@@ -1250,9 +1191,7 @@ reset_nonblock(fd)
 
 /* Like getcwd(), except bsize is ignored if buf is 0 (MAXPATHLEN is used) */
 char *
-ksh_get_wd(buf, bsize)
-	char *buf;
-	int bsize;
+ksh_get_wd(char *buf, int bsize)
 {
 #ifdef HAVE_GETCWD
 	char *b;

+ 1 - 1
sys/src/ape/cmd/pdksh/proto.h

@@ -200,7 +200,7 @@ int 	gmatch		ARGS((const char *s, const char *p, int isfile));
 int	has_globbing	ARGS((const char *xp, const char *xpe));
 const unsigned char *pat_scan ARGS((const unsigned char *p,
 				const unsigned char *pe, int match_sep));
-void 	qsortp		ARGS((void **base, size_t n, int (*f)(void *, void *)));
+void 	qsortp		ARGS((void **base, size_t n, int (*f)(const void *, const void *)));
 int 	xstrcmp		ARGS((void *p1, void *p2));
 void	ksh_getopt_reset ARGS((Getopt *go, int));
 int	ksh_getopt	ARGS((char **argv, Getopt *go, const char *options));

+ 22 - 41
sys/src/ape/cmd/pdksh/table.c

@@ -16,14 +16,13 @@
 #define	INIT_TBLS	8	/* initial table size (power of 2) */
 
 static void     texpand     ARGS((struct table *tp, int nsize));
-static int      tnamecmp    ARGS((void *p1, void *p2));
+static int      tnamecmp    ARGS((const void *p1, const void *p2));
 
 
 unsigned int
-hash(n)
-	register const char * n;
+hash(const char *n)
 {
-	register unsigned int h = 0;
+	unsigned int h = 0;
 
 	while (*n != '\0')
 		h = 2*h + *n++;
@@ -31,10 +30,7 @@ hash(n)
 }
 
 void
-tinit(tp, ap, tsize)
-	register struct table *tp;
-	register Area *ap;
-	int tsize;
+tinit(struct table *tp, Area *ap, int tsize)
 {
 	tp->areap = ap;
 	tp->tbls = NULL;
@@ -44,13 +40,11 @@ tinit(tp, ap, tsize)
 }
 
 static void
-texpand(tp, nsize)
-	register struct table *tp;
-	int nsize;
+texpand(struct table *tp, int nsize)
 {
-	register int i;
-	register struct tbl *tblp, **p;
-	register struct tbl **ntblp, **otblp = tp->tbls;
+	int i;
+	struct tbl *tblp, **p;
+	struct tbl **ntblp, **otblp = tp->tbls;
 	int osize = tp->size;
 
 	ntblp = (struct tbl**) alloc(sizeofN(struct tbl *, nsize), tp->areap);
@@ -78,12 +72,9 @@ texpand(tp, nsize)
 }
 
 struct tbl *
-tsearch(tp, n, h)
-	register struct table *tp;	/* table */
-	register const char *n;		/* name to enter */
-	unsigned int h;			/* hash(n) */
+tsearch(struct table *tp, const char *n, unsigned int h)
 {
-	register struct tbl **pp, *p;
+	struct tbl **pp, *p;
 
 	if (tp->size == 0)
 		return NULL;
@@ -101,13 +92,10 @@ tsearch(tp, n, h)
 }
 
 struct tbl *
-tenter(tp, n, h)
-	register struct table *tp;	/* table */
-	register const char *n;		/* name to enter */
-	unsigned int h;			/* hash(n) */
+tenter(struct table *tp, const char *n, unsigned int h)
 {
-	register struct tbl **pp, *p;
-	register int len;
+	struct tbl **pp, *p;
+	int len;
 
 	if (tp->size == 0)
 		texpand(tp, INIT_TBLS);
@@ -143,24 +131,20 @@ tenter(tp, n, h)
 }
 
 void
-tdelete(p)
-	register struct tbl *p;
+tdelete(tbp *p)
 {
 	p->flag = 0;
 }
 
 void
-twalk(ts, tp)
-	struct tstate *ts;
-	struct table *tp;
+twalk(struct tstate *ts, struct table *tp)
 {
 	ts->left = tp->size;
 	ts->next = tp->tbls;
 }
 
 struct tbl *
-tnext(ts)
-	struct tstate *ts;
+tnext(tstate *ts)
 {
 	while (--ts->left >= 0) {
 		struct tbl *p = *ts->next++;
@@ -171,18 +155,16 @@ tnext(ts)
 }
 
 static int
-tnamecmp(p1, p2)
-	void *p1, *p2;
+tnamecmp(const void *p1, const void *p2)
 {
 	return strcmp(((struct tbl *)p1)->name, ((struct tbl *)p2)->name);
 }
 
 struct tbl **
-tsort(tp)
-	register struct table *tp;
+tsort(table struct *tp)
 {
-	register int i;
-	register struct tbl **p, **sp, **dp;
+	int i;
+	struct tbl **p, **sp, **dp;
 
 	p = (struct tbl **)alloc(sizeofN(struct tbl *, tp->size+1), ATEMP);
 	sp = tp->tbls;		/* source */
@@ -202,8 +184,7 @@ tsort(tp)
 void tprintinfo ARGS((struct table *tp));
 
 void
-tprintinfo(tp)
-	struct table *tp;
+tprintinfo(struct table *tp)
 {
 	struct tbl *te;
 	char *n;
@@ -217,7 +198,7 @@ tprintinfo(tp)
 	shellf("    Ncmp name\n");
 	twalk(&ts, tp);
 	while ((te = tnext(&ts))) {
-		register struct tbl **pp, *p;
+		struct tbl **pp, *p;
 
 		h = hash(n = te->name);
 		ncmp = 0;

+ 1 - 1
sys/src/cmd/5i/stats.c

@@ -150,7 +150,7 @@ struct Prof
 Prof	prof[5000];
 
 int
-profcmp(void *va, void *vb)
+profcmp(const void *va, const void *vb)
 {
 	Prof *a, *b;
 

+ 1 - 1
sys/src/cmd/abaco/cols.c

@@ -223,7 +223,7 @@ colresize(Column *c, Rectangle r)
 
 static
 int
-colcmp(void *a, void *b)
+colcmp(const void *a, const void *b)
 {
 	Rune *r1, *r2;
 	int i, nr1, nr2;

+ 1 - 1
sys/src/cmd/acid/print.c

@@ -49,7 +49,7 @@ char *typenames[] =
 };
 
 int
-cmp(void *va, void *vb)
+cmp(const void *va, const void *vb)
 {
 	char **a = va;
 	char **b = vb;

+ 1 - 1
sys/src/cmd/acme/cols.c

@@ -224,7 +224,7 @@ colresize(Column *c, Rectangle r)
 
 static
 int
-colcmp(void *a, void *b)
+colcmp(const void *a, const void *b)
 {
 	Rune *r1, *r2;
 	int i, nr1, nr2;

+ 1 - 1
sys/src/cmd/acme/fsys.c

@@ -587,7 +587,7 @@ fsyscreate(Xfid *x, Fid*)
 
 static
 int
-idcmp(void *a, void *b)
+idcmp(const void *a, const void *b)
 {
 	return *(int*)a - *(int*)b;
 }

+ 1 - 1
sys/src/cmd/acme/text.c

@@ -117,7 +117,7 @@ textclose(Text *t)
 }
 
 int
-dircmp(void *a, void *b)
+dircmp(const void *a, const void *b)
 {
 	Dirlist *da, *db;
 	int i, n;

+ 1 - 1
sys/src/cmd/astro/astro.h

@@ -159,7 +159,7 @@ extern	double	cosx(double, int, int, int, int, double);
 extern	double	dist(Obj1*, Obj1*);
 extern	double	dsrc(double, Tim*, int);
 extern	void	dtsetup(double, Tim*);
-extern	int	evcomp(void*, void*);
+extern	int	evcomp(const void*, const void*);
 extern	void	event(char*, char*, char*, double, int);
 extern	void	evflush(void);
 extern	double	fmod(double, double);

+ 2 - 2
sys/src/cmd/astro/dist.c

@@ -221,10 +221,10 @@ evflush(void)
 }
 
 int
-evcomp(void *a1, void *a2)
+evcomp(const void *a1, const void *a2)
 {
 	double t1, t2;
-	Event *p1, *p2;
+	const Event *p1, *p2;
 
 	p1 = a1;
 	p2 = a2;

+ 2 - 2
sys/src/cmd/auth/secstore/dirls.c

@@ -56,7 +56,7 @@ sha1file(char *pfx, char *nm)
 }
 
 static int
-compare(Dir *a, Dir *b)
+compare(const Dir *a, const Dir *b)
 {
 	return strcmp(a->name, b->name);
 }
@@ -73,7 +73,7 @@ dirls(char *path)
 	if(path==nil || (ndir = ls(path, &dirbuf)) < 0)
 		return nil;
 
-	qsort(dirbuf, ndir, sizeof dirbuf[0], (int (*)(void *, void *))compare);
+	qsort(dirbuf, ndir, sizeof dirbuf[0], (int (*)(const void *, const void *))compare);
 	for(nmwid=lenwid=i=0; i<ndir; i++){
 		if((m = strlen(dirbuf[i].name)) > nmwid)
 			nmwid = m;

+ 1 - 1
sys/src/cmd/auth/uniq.c

@@ -19,7 +19,7 @@ struct Who
 	char *name;
 };
 
-int cmp(void *arg1, void *arg2)
+int cmp(const void *arg1, const void *arg2)
 {
 	Who **a = arg1, **b = arg2;
 

+ 1 - 1
sys/src/cmd/aux/acidleak.c

@@ -74,7 +74,7 @@ uint ndata;
 uint adata;
 
 int
-addrcmp(void *va, void *vb)
+addrcmp(const void *va, const void *vb)
 {
 	uint32_t *a, *b;
 

+ 1 - 1
sys/src/cmd/cec/cec.c

@@ -239,7 +239,7 @@ ntohs(int h)
 }
 
 int
-tcmp(void *a, void *b)
+tcmp(const void *a, const void *b)
 {
 	Shelf *s, *t;
 	int d;

+ 2 - 2
sys/src/cmd/cwfs/con.c

@@ -59,7 +59,7 @@ consserve1(void *)
 }
 
 static int
-cmdcmp(void *va, void *vb)
+cmdcmp(const void *va, const void *vb)
 {
 	Command *a, *b;
 
@@ -220,7 +220,7 @@ cmd_stata(int, char *[])
 }
 
 static int
-flagcmp(void *va, void *vb)
+flagcmp(const void *va, const void *vb)
 {
 	Flag *a, *b;
 

+ 1 - 1
sys/src/cmd/cwfs/main.c

@@ -353,7 +353,7 @@ main(int argc, char **argv)
  * read the device.
  */
 int
-rbcmp(void *va, void *vb)
+rbcmp(const void *va, const void *vb)
 {
 	Rabuf *ra, *rb;
 

+ 1 - 1
sys/src/cmd/cwfs/uidgid.c

@@ -546,7 +546,7 @@ leadgroup(int ui, int gi)
 }
 
 int
-byuid(void *a1, void *a2)
+byuid(const void *a1, const void *a2)
 {
 	Uid *u1, *u2;
 

+ 1 - 1
sys/src/cmd/dict/dict.c

@@ -562,7 +562,7 @@ getfield(Rune *rp)
  * A compare longs function suitable for qsort
  */
 static int
-longcmp(void *av, void *bv)
+longcmp(const void *av, const void *bv)
 {
 	int32_t v;
 	int32_t *a, *b;

+ 1 - 1
sys/src/cmd/diff/diffdir.c

@@ -13,7 +13,7 @@
 #include "diff.h"
 
 static int
-itemcmp(void *v1, void *v2)
+itemcmp(const void *v1, const void *v2)
 {
 	char **d1 = v1, **d2 = v2;
 

+ 2 - 2
sys/src/cmd/disk/exsort.c

@@ -10,7 +10,7 @@
 #include	<u.h>
 #include	<libc.h>
 
-int	ulcmp(void*, void*);
+int	ulcmp(const void*, const void*);
 void	swapem(uint32_t*, int32_t);
 
 enum
@@ -114,7 +114,7 @@ main(int argc, char *argv[])
 }
 
 int
-ulcmp(void *va, void *vb)
+ulcmp(const void *va, const void *vb)
 {
 	uint32_t *a, *b;
 

+ 2 - 2
sys/src/cmd/disk/kfs/uid.c

@@ -18,7 +18,7 @@ struct
 } uidgc;
 
 int
-byuid(void *a1, void *a2)
+byuid(const void *a1, const void *a2)
 {
 	Uid *u1, *u2;
 
@@ -28,7 +28,7 @@ byuid(void *a1, void *a2)
 }
 
 int
-byname(void *a1, void *a2)
+byname(const void *a1, const void *a2)
 {
 	Uid *u1, *u2;
 

+ 1 - 1
sys/src/cmd/fossil/cache.c

@@ -1930,7 +1930,7 @@ unlinkThread(void *a)
 }
 
 static int
-baddrCmp(void *a0, void *a1)
+baddrCmp(const void *a0, const void *a1)
 {
 	BAddr *b0, *b1;
 	b0 = a0;

+ 1 - 1
sys/src/cmd/fossil/check.c

@@ -456,7 +456,7 @@ struct MetaChunk {
 };
 
 static int
-offsetCmp(void *s0, void *s1)
+offsetCmp(const void *s0, const void *s1)
 {
 	MetaChunk *mc0, *mc1;
 

+ 1 - 1
sys/src/cmd/fossil/vac.c

@@ -365,7 +365,7 @@ meCmpOld(MetaEntry *me, char *s)
 }
 
 static int
-offsetCmp(void *s0, void *s1)
+offsetCmp(const void *s0, const void *s1)
 {
 	MetaChunk *mc0, *mc1;
 

+ 2 - 2
sys/src/cmd/grep/comp.c

@@ -72,7 +72,7 @@ cont:	;
 }
 
 int
-fcmp(void *va, void *vb)
+fcmp(const void *va, const void *vb)
 {
 	Re **aa, **bb;
 	Re *a, *b;
@@ -196,7 +196,7 @@ rclass(Rune p0, Rune p1)
 }
 
 int
-pcmp(void *va, void *vb)
+pcmp(const void *va, const void *vb)
 {
 	int n;
 	Rune *a, *b;

+ 1 - 1
sys/src/cmd/grep/grep.h

@@ -105,7 +105,7 @@ EXTERN Re2 topre;
 extern Re *addcase(Re *);
 extern void appendnext(Re *, Re *);
 extern void error(char *);
-extern int fcmp(void *, void *);	/* (Re**, Re**) */
+extern int fcmp(const void *, const void *);	/* (Re**, Re**) */
 extern void fol1(Re *, int);
 extern int getrec(void);
 extern void increment(State *, int);

+ 1 - 1
sys/src/cmd/ip/ftpd.c

@@ -947,7 +947,7 @@ listfile(Biobufhdr *b, char *name, int lflag, char *dname)
 	free(d);
 }
 int
-dircomp(void *va, void *vb)
+dircomp(const void *va, const void *vb)
 {
 	int rv;
 	Dir *a, *b;

+ 2 - 2
sys/src/cmd/ip/httpd/webls.c

@@ -152,7 +152,7 @@ allowed(char *dir)
  * Comparison routine for sorting the directory.
  */
 static int
-compar(Dir *a, Dir *b)
+compar(const Dir *a, const Dir *b)
 {
 	return(strcmp(a->name, b->name));
 }
@@ -245,7 +245,7 @@ dols(char *dir)
 	n = dirreadall(fd, &d);
 	close(fd);
 	maxwidths(d, n);
-	qsort(d, n, sizeof(Dir), (int (*)(void *, void *))compar);
+	qsort(d, n, sizeof(Dir), (int (*)(const void *, const void *))compar);
 	hprint(hout, "<pre>\n");
 	for (i = 0; i < n; i++) {
 		f = smprint("%s/%s", dir, d[i].name);

+ 1 - 1
sys/src/cmd/ki/stats.c

@@ -165,7 +165,7 @@ struct Prof
 Prof	prof[5000];
 
 int
-profcmp(void *va, void *vb)
+profcmp(const void *va, const void *vb)
 {
 	Prof *a, *b;
 

+ 1 - 1
sys/src/cmd/kprof.c

@@ -33,7 +33,7 @@ error(int perr, char *s)
 }
 
 int
-compar(void *va, void *vb)
+compar(const void *va, const void *vb)
 {
 	struct COUNTER *a, *b;
 

+ 3 - 3
sys/src/cmd/ls.c

@@ -37,7 +37,7 @@ int	ndirbuf;
 int	ndir;
 NDir*	dirbuf;
 int	ls(char*, int);
-int	compar(NDir*, NDir*);
+int	compar(const NDir*, const NDir*);
 char*	asciitime(int32_t);
 char*	darwx(int32_t);
 void	rwx(int32_t, char*);
@@ -149,7 +149,7 @@ output(void)
 	char *s;
 
 	if(!nflag)
-		qsort(dirbuf, ndir, sizeof dirbuf[0], (int (*)(void *c, void*))compar);
+		qsort(dirbuf, ndir, sizeof dirbuf[0], (int (*)(const void *, const void*))compar);
 	for(i=0; i<ndir; i++)
 		dowidths(dirbuf[i].d);
 	for(i=0; i<ndir; i++) {
@@ -260,7 +260,7 @@ growto(int32_t n)
 }
 
 int
-compar(NDir *a, NDir *b)
+compar(const NDir *a, const NDir *b)
 {
 	int32_t i;
 	Dir *ad, *bd;

+ 2 - 2
sys/src/cmd/news.c

@@ -44,7 +44,7 @@ int	n_count;
 int	n_items;
 Biobuf	bout;
 
-int	fcmp(void *a, void *b);
+int	fcmp(const void *a, const void *b);
 void	read_dir(int update);
 void	print_item(char *f);
 void	eachitem(void (*emit)(char*), int all, int update);
@@ -81,7 +81,7 @@ main(int argc, char *argv[])
 }
 
 int
-fcmp(void *a, void *b)
+fcmp(const void *a, const void *b)
 {
 	int32_t x;
 

+ 2 - 2
sys/src/cmd/nm.c

@@ -37,7 +37,7 @@ Sym	**symptr;
 int	nsym;
 Biobuf	bout;
 
-int	cmp(void *c, void*);
+int	cmp(const void *c, const void*);
 void	error(char*, ...);
 void	execsyms(int);
 void	psym(Sym*, void*);
@@ -156,7 +156,7 @@ dofile(Biobuf *bp)
  *	this screws up on 'z' records when aflag == 1
  */
 int
-cmp(void *vs, void *vt)
+cmp(const void *vs, const void *vt)
 {
 	Sym **s, **t;
 

+ 1 - 1
sys/src/cmd/nntpfs.c

@@ -303,7 +303,7 @@ nntpxcmdprobe(Netbuf *n)
 
 /* XXX: searching, lazy evaluation */
 static int
-overcmp(void *v1, void *v2)
+overcmp(const void *v1, const void *v2)
 {
 	int a, b;
 

+ 1 - 1
sys/src/cmd/prof.c

@@ -109,7 +109,7 @@ swapdata(Data *dp)
 }
 
 int
-acmp(void *va, void *vb)
+acmp(const void *va, const void *vb)
 {
 	Acc *a, *b;
 	uint32_t ua, ub;

+ 2 - 2
sys/src/cmd/ps.c

@@ -13,7 +13,7 @@
 
 void	ps(char*);
 void	error(char*);
-int	cmp(void *c, void*);
+int	cmp(const void *c, const void*);
 
 Biobuf	bout;
 int	pflag;
@@ -162,7 +162,7 @@ error(char *s)
 }
 
 int
-cmp(void *va, void *vb)
+cmp(const void *va, const void *vb)
 {
 	Dir **a, **b;
 

+ 1 - 1
sys/src/cmd/qc/reg.c

@@ -25,7 +25,7 @@ rega(void)
 }
 
 int
-rcmp(void *a1, void *a2)
+rcmp(const void *a1, const void *a2)
 {
 	Rgn *p1, *p2;
 	int c1, c2;

+ 1 - 1
sys/src/cmd/qi/stats.c

@@ -164,7 +164,7 @@ struct Prof
 Prof	prof[5000];
 
 int
-profcmp(void *a, void *b)
+profcmp(const void *a, const void *b)
 {
 	return ((Prof*)b)->count - ((Prof*)a)->count;
 }

+ 1 - 1
sys/src/cmd/ql/span.c

@@ -448,7 +448,7 @@ cmp(int a, int b)
 }
 
 int
-ocmp(void *a1, void *a2)
+ocmp(const void *a1, const void *a2)
 {
 	Optab *p1, *p2;
 	int n;

+ 1 - 1
sys/src/cmd/ratfs/ctlfiles.c

@@ -370,7 +370,7 @@ ipinsert(Node *np, char *cp)
 }
 
 int
-ipcomp(void *a, void *b)
+ipcomp(const void *a, const void *b)
 {
 	uint32_t aip, bip;
 

+ 1 - 1
sys/src/cmd/rc/glob.c

@@ -29,7 +29,7 @@ deglob(void *as)
 }
 
 int
-globcmp(void *s, void *t)
+globcmp(const void *s, const void *t)
 {
 	return strcmp(*(char**)s, *(char**)t);
 }

+ 1 - 1
sys/src/cmd/rdbfs.c

@@ -367,7 +367,7 @@ fswrite(Req *r)
 
 struct {
 	char *s;
-	int id;
+	int64_t id;
 	int mode;
 } tab[] = {
 	"ctl",		Xctl,		0222,

+ 1 - 1
sys/src/cmd/rio/fsys.c

@@ -520,7 +520,7 @@ filsyscreate(Filsys *fs, Xfid *x, Fid*f)
 
 static
 int
-idcmp(void *a, void *b)
+idcmp(const void *a, const void *b)
 {
 	return *(int*)a - *(int*)b;
 }

+ 1 - 1
sys/src/cmd/scat/scat.c

@@ -673,7 +673,7 @@ cull(char *s, int keep, int dobbox)
 }
 
 int
-compar(void *va, void *vb)
+compar(const void *va, const void *vb)
 {
 	Record *a=va, *b=vb;
 

+ 6 - 1
sys/src/cmd/sed.c

@@ -151,7 +151,7 @@ int	sflag;				/* Set when substitution done */
 int	jflag;				/* Set when jump required */
 int	delflag;			/* Delete current line when set */
 
-int32_t	lnum = 0;			/* Input line count */
+int64_t	lnum = 0;			/* Input line count */
 
 char	fname[MAXFILES][40];		/* File name cache */
 Biobuf	*fcode[MAXFILES];		/* File ID cache */
@@ -778,6 +778,7 @@ address(Addr *ap)
 	}
 }
 
+int
 cmp(char *a, char *b)		/* compare characters */
 {
 	while(*a == *b++)
@@ -787,6 +788,8 @@ cmp(char *a, char *b)		/* compare characters */
 			a++;
 	return 1;
 }
+
+int
 rcmp(Rune *a, Rune *b)		/* compare runes */
 {
 	while(*a == *b++)
@@ -1328,6 +1331,8 @@ putline(Biobuf *bp, Rune *buf, int n)
 		Bputrune(bp, *buf++);
 	Bputc(bp, '\n');
 }
+
+int
 ecmp(Rune *a, Rune *b, int count)
 {
 	while(count--)

+ 2 - 2
sys/src/cmd/spell/pcode.c

@@ -36,7 +36,7 @@ Biobuf	bout;
 
 void	readinput(int f);
 int32_t	typecode(char *str);
-int	wcmp(void*, void*);
+int	wcmp(const void*, const void*);
 void	pdict(void);
 void	sput(int);
 
@@ -68,7 +68,7 @@ main(int argc, char *argv[])
 	exits(0);
 }
 
-wcmp(void *a, void *b)
+wcmp(const void *a, const void *b)
 {
 
 	return strcmp(((Dict*)a)->word, ((Dict*)b)->word);

+ 0 - 1
sys/src/cmd/tar.c

@@ -135,7 +135,6 @@ typedef struct {
 
 #define OTHER(rdwr) ((rdwr) == Rd? Wr: Rd)
 
-static int debug;
 static int fixednblock;
 static int verb;
 static int posix = 1;

+ 1 - 1
sys/src/cmd/testalarm.c

@@ -10,7 +10,7 @@
 #include <u.h>
 #include <libc.h>
 
-static int
+static void
 catch(void *p, char *s)
 {
 	print("catch %p %s\n", p, s);

+ 1 - 1
sys/src/cmd/time.c

@@ -81,7 +81,7 @@ main(int argc, char *argv[])
 void
 add(char *a, ...)
 {
-	static beenhere=0;
+	static int beenhere=0;
 	va_list arg;
 
 	if(beenhere)

+ 1 - 0
sys/src/cmd/touch.c

@@ -51,6 +51,7 @@ main(int argc, char **argv)
 	exits(0);
 }
 
+int
 touch(int nocreate, char *name)
 {
 	Dir stbuff;

+ 1 - 1
sys/src/cmd/tprof.c

@@ -33,7 +33,7 @@ error(int perr, char *s)
 }
 
 int
-compar(void *va, void *vb)
+compar(const void *va, const void *vb)
 {
 	struct COUNTER *a, *b;
 

+ 1 - 1
sys/src/cmd/upas/fs/planb.c

@@ -211,7 +211,7 @@ readpbmessage(Mailbox *mb, char *msg, int doplumb)
 }
 
 static int
-dcmp(Dir *a, Dir *b)
+dcmp(const Dir *a, const Dir *b)
 {
 	char *an, *bn;
 

+ 1 - 1
sys/src/cmd/upas/pop3/pop3.c

@@ -167,7 +167,7 @@ main(int argc, char **argv)
 
 /* sort directories in increasing message number order */
 static int
-dircmp(void *a, void *b)
+dircmp(const void *a, const void *b)
 {
 	return atoi(((Dir*)a)->name) - atoi(((Dir*)b)->name);
 }

+ 1 - 1
sys/src/cmd/upas/smtp/mxdial.c

@@ -300,7 +300,7 @@ mxlookup1(DS *ds, char *domain)
 }
 
 static int
-compar(void *a, void *b)
+compar(const void *a, const void *b)
 {
 	return ((Mx*)a)->pref - ((Mx*)b)->pref;
 }

+ 1 - 1
sys/src/cmd/vi/stats.c

@@ -202,7 +202,7 @@ struct Prof
 Prof	prof[5000];
 
 int
-profcmp(void *va, void *vb)
+profcmp(const void *va, const void *vb)
 {
 	Prof *a, *b;
 

+ 1 - 1
sys/src/cmd/webcookies.c

@@ -148,7 +148,7 @@ cookiefmt(Fmt *fmt)
  *	- longer paths first, then alpha by path (RFC2109 4.3.4)
  */
 int
-cookiecmp(Cookie *a, Cookie *b)
+cookiecmp(const Cookie *a, const Cookie *b)
 {
 	int i;
 

+ 3 - 3
sys/src/cmd/webfs/cookies.c

@@ -146,7 +146,7 @@ cookiefmt(Fmt *fp)
  *	- longer paths first, then alpha by path (RFC2109 4.3.4)
  */
 static int
-cookiecmp(Cookie *a, Cookie *b)
+cookiecmp(const Cookie *a, const Cookie *b)
 {
 	int i;
 
@@ -162,7 +162,7 @@ cookiecmp(Cookie *a, Cookie *b)
 }
 
 static int
-exactcookiecmp(Cookie *a, Cookie *b)
+exactcookiecmp(const Cookie *a, const Cookie *b)
 {
 	int i;
 
@@ -605,7 +605,7 @@ cookiesearch(Jar *jar, char *dom, char *path, int issecure)
 		werrstr("no cookies found");
 		return nil;
 	}
-	qsort(j->c, j->nc, sizeof(j->c[0]), (int(*)(void*, void*))cookiecmp);
+	qsort(j->c, j->nc, sizeof(j->c[0]), cookiecmp);
 	return j;
 }
 

+ 2 - 2
sys/src/libc/port/qsort.c

@@ -16,7 +16,7 @@
 typedef
 struct
 {
-	int	(*cmp)(void*, void*);
+	int	(*cmp)(const void*, const void*);
 	void	(*swap)(char*, char*, int32_t);
 	int32_t	es;
 } Sort;
@@ -120,7 +120,7 @@ qsorts(char *a, int32_t n, Sort *p)
 }
 
 void
-qsort(void *va, int32_t n, int32_t es, int (*cmp)(void*, void*))
+qsort(void *va, int32_t n, int32_t es, int (*cmp)(const void*, const void*))
 {
 	Sort s;
 

+ 6 - 6
sys/src/libmach/sym.c

@@ -77,10 +77,10 @@ static int	hcomp(Hist*, int16_t*);
 static int	hline(File*, int16_t*, int32_t*);
 static void	printhist(char*, Hist*, int);
 static int	buildtbls(void);
-static int	symcomp(void*, void*);
+static int	symcomp(const void*, const void*);
 static int	symerrmsg(int, char*);
-static int	txtcomp(void*, void*);
-static int	filecomp(void*, void*);
+static int	txtcomp(const void*, const void*);
+static int	filecomp(const void*, const void*);
 
 /*
  *	initialize the symbol tables
@@ -1145,7 +1145,7 @@ fileelem(Sym **fp, uint8_t *cp, char *buf, int n)
  *	compare the values of two symbol table entries.
  */
 static int
-symcomp(void *a, void *b)
+symcomp(const void *a, const void *b)
 {
 	int i;
 
@@ -1159,7 +1159,7 @@ symcomp(void *a, void *b)
  *	compare the values of the symbols referenced by two text table entries
  */
 static int
-txtcomp(void *a, void *b)
+txtcomp(const void *a, const void *b)
 {
 	return ((Txtsym*)a)->sym->value - ((Txtsym*)b)->sym->value;
 }
@@ -1168,7 +1168,7 @@ txtcomp(void *a, void *b)
  *	compare the values of the symbols referenced by two file table entries
  */
 static int
-filecomp(void *a, void *b)
+filecomp(const void *a, const void *b)
 {
 	return ((File*)a)->addr - ((File*)b)->addr;
 }

+ 6 - 6
sys/src/libmemdraw/fillpoly.c

@@ -29,9 +29,9 @@ struct Seg
 };
 
 static	void	zsort(Seg **seg, Seg **ep);
-static	int	ycompare(void*, void*);
-static	int	xcompare(void*, void*);
-static	int	zcompare(void*, void*);
+static	int	ycompare(const void*, const void*);
+static	int	xcompare(const void*, const void*);
+static	int	zcompare(const void*, const void*);
 static	void	xscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int, int, int);
 static	void	yscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int);
 
@@ -478,7 +478,7 @@ zsort(Seg **seg, Seg **ep)
 }
 
 static int
-ycompare(void *a, void *b)
+ycompare(const void *a, const void *b)
 {
 	Seg **s0, **s1;
 	int32_t y0, y1;
@@ -496,7 +496,7 @@ ycompare(void *a, void *b)
 }
 
 static int
-xcompare(void *a, void *b)
+xcompare(const void *a, const void *b)
 {
 	Seg **s0, **s1;
 	int32_t x0, x1;
@@ -514,7 +514,7 @@ xcompare(void *a, void *b)
 }
 
 static int
-zcompare(void *a, void *b)
+zcompare(const void *a, const void *b)
 {
 	Seg **s0, **s1;
 	int32_t z0, z1;