svn commit: r287793 - in head/lib/libc: gen gmon stdlib

Craig Rodrigues rodrigc at FreeBSD.org
Mon Sep 14 18:44:17 UTC 2015


Author: rodrigc
Date: Mon Sep 14 18:44:13 2015
New Revision: 287793
URL: https://svnweb.freebsd.org/changeset/base/287793

Log:
  Use ANSI C prototypes.
  
  Eliminates gcc 4.9 warnings.

Modified:
  head/lib/libc/gen/fts-compat.c
  head/lib/libc/gen/getloadavg.c
  head/lib/libc/gen/getmntinfo.c
  head/lib/libc/gen/nlist.c
  head/lib/libc/gen/strtofflags.c
  head/lib/libc/gmon/gmon.c
  head/lib/libc/stdlib/heapsort.c
  head/lib/libc/stdlib/merge.c
  head/lib/libc/stdlib/radixsort.c

Modified: head/lib/libc/gen/fts-compat.c
==============================================================================
--- head/lib/libc/gen/fts-compat.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/gen/fts-compat.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -635,9 +635,7 @@ __fts_set_clientptr_44bsd(FTS *sp, void 
  * been found, cutting the stat calls by about 2/3.
  */
 static FTSENT *
-fts_build(sp, type)
-	FTS *sp;
-	int type;
+fts_build(FTS *sp, int type)
 {
 	struct dirent *dp;
 	FTSENT *p, *head;
@@ -901,10 +899,7 @@ mem1:				saved_errno = errno;
 }
 
 static u_short
-fts_stat(sp, p, follow)
-	FTS *sp;
-	FTSENT *p;
-	int follow;
+fts_stat(FTS *sp, FTSENT *p, int follow)
 {
 	FTSENT *t;
 	dev_t dev;
@@ -999,10 +994,7 @@ fts_compar(const void *a, const void *b)
 }
 
 static FTSENT *
-fts_sort(sp, head, nitems)
-	FTS *sp;
-	FTSENT *head;
-	int nitems;
+fts_sort(FTS *sp, FTSENT *head, int nitems)
 {
 	FTSENT **ap, *p;
 
@@ -1031,10 +1023,7 @@ fts_sort(sp, head, nitems)
 }
 
 static FTSENT *
-fts_alloc(sp, name, namelen)
-	FTS *sp;
-	char *name;
-	int namelen;
+fts_alloc(FTS *sp, char *name, int namelen)
 {
 	FTSENT *p;
 	size_t len;
@@ -1081,8 +1070,7 @@ fts_alloc(sp, name, namelen)
 }
 
 static void
-fts_lfree(head)
-	FTSENT *head;
+fts_lfree(FTSENT *head)
 {
 	FTSENT *p;
 
@@ -1100,9 +1088,7 @@ fts_lfree(head)
  * plus 256 bytes so don't realloc the path 2 bytes at a time.
  */
 static int
-fts_palloc(sp, more)
-	FTS *sp;
-	size_t more;
+fts_palloc(FTS *sp, size_t more)
 {
 
 	sp->fts_pathlen += more + 256;
@@ -1127,9 +1113,7 @@ fts_palloc(sp, more)
  * already returned.
  */
 static void
-fts_padjust(sp, head)
-	FTS *sp;
-	FTSENT *head;
+fts_padjust(FTS *sp, FTSENT *head)
 {
 	FTSENT *p;
 	char *addr = sp->fts_path;
@@ -1153,8 +1137,7 @@ fts_padjust(sp, head)
 }
 
 static size_t
-fts_maxarglen(argv)
-	char * const *argv;
+fts_maxarglen(char * const *argv)
 {
 	size_t len, max;
 
@@ -1170,11 +1153,7 @@ fts_maxarglen(argv)
  * Assumes p->fts_dev and p->fts_ino are filled in.
  */
 static int
-fts_safe_changedir(sp, p, fd, path)
-	FTS *sp;
-	FTSENT *p;
-	int fd;
-	char *path;
+fts_safe_changedir(FTS *sp, FTSENT *p, int fd, char *path)
 {
 	int ret, oerrno, newfd;
 	struct stat sb;

Modified: head/lib/libc/gen/getloadavg.c
==============================================================================
--- head/lib/libc/gen/getloadavg.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/gen/getloadavg.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$");
  * Return number of samples retrieved, or -1 on error.
  */
 int
-getloadavg(loadavg, nelem)
-	double loadavg[];
-	int nelem;
+getloadavg(double loadavg[], int nelem)
 {
 	struct loadavg loadinfo;
 	int i, mib[2];

Modified: head/lib/libc/gen/getmntinfo.c
==============================================================================
--- head/lib/libc/gen/getmntinfo.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/gen/getmntinfo.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -42,9 +42,7 @@ __FBSDID("$FreeBSD$");
  * Return information about mounted filesystems.
  */
 int
-getmntinfo(mntbufp, flags)
-	struct statfs **mntbufp;
-	int flags;
+getmntinfo(struct statfs **mntbufp, int flags)
 {
 	static struct statfs *mntbuf;
 	static int mntsize;

Modified: head/lib/libc/gen/nlist.c
==============================================================================
--- head/lib/libc/gen/nlist.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/gen/nlist.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -63,9 +63,7 @@ int __aout_fdnlist(int, struct nlist *);
 int __elf_fdnlist(int, struct nlist *);
 
 int
-nlist(name, list)
-	const char *name;
-	struct nlist *list;
+nlist(const char *name, struct nlist *list)
 {
 	int fd, n;
 
@@ -89,11 +87,10 @@ static struct nlist_handlers {
 };
 
 int
-__fdnlist(fd, list)
-	int fd;
-	struct nlist *list;
+__fdnlist(int fd, struct nlist *list)
 {
-	int n = -1, i;
+	int n = -1;
+	unsigned int i;
 
 	for (i = 0; i < sizeof(nlist_fn) / sizeof(nlist_fn[0]); i++) {
 		n = (nlist_fn[i].fn)(fd, list);
@@ -107,9 +104,7 @@ __fdnlist(fd, list)
 
 #ifdef _NLIST_DO_AOUT
 int
-__aout_fdnlist(fd, list)
-	int fd;
-	struct nlist *list;
+__aout_fdnlist(int fd, struct nlist *list)
 {
 	struct nlist *p, *symtab;
 	caddr_t strtab, a_out_mmap;
@@ -235,9 +230,7 @@ __elf_is_okay__(Elf_Ehdr *ehdr)
 }
 
 int
-__elf_fdnlist(fd, list)
-	int fd;
-	struct nlist *list;
+__elf_fdnlist(int fd, struct nlist *list)
 {
 	struct nlist *p;
 	Elf_Off symoff = 0, symstroff = 0;
@@ -377,11 +370,7 @@ __elf_fdnlist(fd, list)
  * n_value and n_type members.
  */
 static void
-elf_sym_to_nlist(nl, s, shdr, shnum)
-	struct nlist *nl;
-	Elf_Sym *s;
-	Elf_Shdr *shdr;
-	int shnum;
+elf_sym_to_nlist(struct nlist *nl, Elf_Sym *s, Elf_Shdr *shdr, int shnum)
 {
 	nl->n_value = s->st_value;
 

Modified: head/lib/libc/gen/strtofflags.c
==============================================================================
--- head/lib/libc/gen/strtofflags.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/gen/strtofflags.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -94,8 +94,7 @@ static struct {
  *	are set, return the empty string.
  */
 char *
-fflagstostr(flags)
-	u_long flags;
+fflagstostr(u_long flags)
 {
 	char *string;
 	const char *sp;
@@ -128,9 +127,7 @@ fflagstostr(flags)
  *	to the offending token.
  */
 int
-strtofflags(stringp, setp, clrp)
-	char **stringp;
-	u_long *setp, *clrp;
+strtofflags(char **stringp, u_long *setp, u_long *clrp)
 {
 	char *string, *p;
 	int i;

Modified: head/lib/libc/gmon/gmon.c
==============================================================================
--- head/lib/libc/gmon/gmon.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/gmon/gmon.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -70,9 +70,7 @@ void	moncontrol(int);
 static int hertz(void);
 
 void
-monstartup(lowpc, highpc)
-	u_long lowpc;
-	u_long highpc;
+monstartup(u_long lowpc, u_long highpc)
 {
 	int o;
 	char *cp;
@@ -218,8 +216,7 @@ _mcleanup(void)
  *	all the data structures are ready.
  */
 void
-moncontrol(mode)
-	int mode;
+moncontrol(int mode)
 {
 	struct gmonparam *p = &_gmonparam;
 
@@ -239,7 +236,7 @@ moncontrol(mode)
  * if something goes wrong, we return 0, an impossible hertz.
  */
 static int
-hertz()
+hertz(void)
 {
 	struct itimerval tim;
 

Modified: head/lib/libc/stdlib/heapsort.c
==============================================================================
--- head/lib/libc/stdlib/heapsort.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/stdlib/heapsort.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -147,16 +147,11 @@ typedef DECLARE_BLOCK(int, heapsort_bloc
  */
 #ifdef I_AM_HEAPSORT_B
 int
-heapsort_b(vbase, nmemb, size, compar)
-	void *vbase;
-	size_t nmemb, size;
-	heapsort_block compar;
+heapsort_b(void *vbase, size_t nmemb, size_t size, heapsort_block compar)
 #else
 int
-heapsort(vbase, nmemb, size, compar)
-	void *vbase;
-	size_t nmemb, size;
-	int (*compar)(const void *, const void *);
+heapsort(void *vbase, size_t nmemb, size_t size,
+    int (*compar)(const void *, const void *))
 #endif
 {
 	size_t cnt, i, j, l;

Modified: head/lib/libc/stdlib/merge.c
==============================================================================
--- head/lib/libc/stdlib/merge.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/stdlib/merge.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -104,14 +104,10 @@ static void insertionsort(u_char *, size
  */
 int
 #ifdef I_AM_MERGESORT_B
-mergesort_b(base, nmemb, size, cmp)
+mergesort_b(void *base, size_t nmemb, size_t size, cmp_t cmp)
 #else
-mergesort(base, nmemb, size, cmp)
+mergesort(void *base, size_t nmemb, size_t size, cmp_t cmp)
 #endif
-	void *base;
-	size_t nmemb;
-	size_t size;
-	cmp_t cmp;
 {
 	size_t i;
 	int sense;
@@ -271,10 +267,7 @@ COPY:	    			b = t;
  * is defined.  Otherwise simple pairwise merging is used.)
  */
 void
-setup(list1, list2, n, size, cmp)
-	size_t n, size;
-	u_char *list1, *list2;
-	cmp_t cmp;
+setup(u_char *list1, u_char *list2, size_t n, size_t size, cmp_t cmp)
 {
 	int i, length, size2, tmp, sense;
 	u_char *f1, *f2, *s, *l2, *last, *p2;
@@ -345,10 +338,7 @@ setup(list1, list2, n, size, cmp)
  * last 4 elements.
  */
 static void
-insertionsort(a, n, size, cmp)
-	u_char *a;
-	size_t n, size;
-	cmp_t cmp;
+insertionsort(u_char *a, size_t n, size_t size, cmp_t cmp)
 {
 	u_char *ai, *s, *t, *u, tmp;
 	int i;

Modified: head/lib/libc/stdlib/radixsort.c
==============================================================================
--- head/lib/libc/stdlib/radixsort.c	Mon Sep 14 18:05:27 2015	(r287792)
+++ head/lib/libc/stdlib/radixsort.c	Mon Sep 14 18:44:13 2015	(r287793)
@@ -88,10 +88,7 @@ static void r_sort_b(const u_char **, co
 }
 
 int
-radixsort(a, n, tab, endch)
-	const u_char **a, *tab;
-	int n;
-	u_int endch;
+radixsort(const u_char **a, int n, const u_char *tab, u_int endch)
 {
 	const u_char *tr;
 	int c;
@@ -103,10 +100,7 @@ radixsort(a, n, tab, endch)
 }
 
 int
-sradixsort(a, n, tab, endch)
-	const u_char **a, *tab;
-	int n;
-	u_int endch;
+sradixsort(const u_char **a, int n, const u_char *tab, u_int endch)
 {
 	const u_char *tr, **ta;
 	int c;
@@ -131,11 +125,7 @@ sradixsort(a, n, tab, endch)
 
 /* Unstable, in-place sort. */
 static void
-r_sort_a(a, n, i, tr, endch)
-	const u_char **a;
-	int n, i;
-	const u_char *tr;
-	u_int endch;
+r_sort_a(const u_char **a, int n, int i, const u_char *tr, u_int endch)
 {
 	static int count[256], nc, bmin;
 	int c;
@@ -233,11 +223,8 @@ r_sort_a(a, n, i, tr, endch)
 
 /* Stable sort, requiring additional memory. */
 static void
-r_sort_b(a, ta, n, i, tr, endch)
-	const u_char **a, **ta;
-	int n, i;
-	const u_char *tr;
-	u_int endch;
+r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr,
+    u_int endch)
 {
 	static int count[256], nc, bmin;
 	int c;
@@ -304,12 +291,9 @@ r_sort_b(a, ta, n, i, tr, endch)
 	}
 }
 
+/* insertion sort */
 static inline void
-simplesort(a, n, b, tr, endch)	/* insertion sort */
-	const u_char **a;
-	int n, b;
-	const u_char *tr;
-	u_int endch;
+simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch)
 {
 	u_char ch;
 	const u_char  **ak, **ai, *s, *t;


More information about the svn-src-head mailing list