Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin ANSIfy, sprinkle "const" in some obvious cases
details: https://anonhg.NetBSD.org/src/rev/1352d940b422
branches: trunk
changeset: 749089:1352d940b422
user: drochner <drochner%NetBSD.org@localhost>
date: Tue Nov 17 18:31:12 2009 +0000
description:
ANSIfy, sprinkle "const" in some obvious cases
diffstat:
usr.bin/locate/bigram/locate.bigram.c | 20 ++++++----------
usr.bin/mkstr/mkstr.c | 42 +++++++++++++---------------------
usr.bin/rpcinfo/rpcinfo.c | 37 +++++++++---------------------
usr.bin/xstr/xstr.c | 7 ++---
4 files changed, 38 insertions(+), 68 deletions(-)
diffs (282 lines):
diff -r e268c31c8ec5 -r 1352d940b422 usr.bin/locate/bigram/locate.bigram.c
--- a/usr.bin/locate/bigram/locate.bigram.c Tue Nov 17 17:54:14 2009 +0000
+++ b/usr.bin/locate/bigram/locate.bigram.c Tue Nov 17 18:31:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: locate.bigram.c,v 1.11 2008/07/21 14:19:23 lukem Exp $ */
+/* $NetBSD: locate.bigram.c,v 1.12 2009/11/17 18:31:12 drochner Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)locate.bigram.c 8.2 (Berkeley) 4/28/95";
#endif
-__RCSID("$NetBSD: locate.bigram.c,v 1.11 2008/07/21 14:19:23 lukem Exp $");
+__RCSID("$NetBSD: locate.bigram.c,v 1.12 2009/11/17 18:31:12 drochner Exp $");
#endif /* not lint */
/*
@@ -57,9 +57,9 @@
#include <string.h>
#include <sys/param.h> /* for MAXPATHLEN */
-int main __P((int, char **));
-static int compare_bigrams __P((const void *, const void *));
-static void add_bigram __P((u_char, u_char));
+int main(int, char **);
+static int compare_bigrams(const void *, const void *);
+static void add_bigram(u_char, u_char);
static char buf1[MAXPATHLEN] = " ";
static char buf2[MAXPATHLEN];
@@ -72,16 +72,14 @@
struct bigram bigrams[256 * 256];
static void
-add_bigram(i1, i2)
- u_char i1, i2;
+add_bigram(u_char i1, u_char i2)
{
if (i1 != '\n' && i2 != '\n')
bigrams[(i1<<8)+i2].count++;
}
static int
-compare_bigrams(item1, item2)
- const void *item1, *item2;
+compare_bigrams(const void *item1, const void *item2)
{
const struct bigram *it1=item1, *it2=item2;
@@ -94,9 +92,7 @@
}
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
char *cp;
char *oldpath = buf1, *path = buf2;
diff -r e268c31c8ec5 -r 1352d940b422 usr.bin/mkstr/mkstr.c
--- a/usr.bin/mkstr/mkstr.c Tue Nov 17 17:54:14 2009 +0000
+++ b/usr.bin/mkstr/mkstr.c Tue Nov 17 18:31:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkstr.c,v 1.14 2009/04/13 00:41:28 lukem Exp $ */
+/* $NetBSD: mkstr.c,v 1.15 2009/11/17 18:31:13 drochner Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)mkstr.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: mkstr.c,v 1.14 2009/04/13 00:41:28 lukem Exp $");
+__RCSID("$NetBSD: mkstr.c,v 1.15 2009/11/17 18:31:13 drochner Exp $");
#endif
#endif /* not lint */
@@ -81,19 +81,17 @@
const char usagestr[] = "usage: %s [ - ] mesgfile prefix file ...\n";
char name[100], *np;
-void process __P((void));
-int main __P((int, char **));
-int match __P((const char *));
-int octdigit __P((char));
-void inithash __P((void));
-long hashit __P((char *, char, long));
-void copystr __P((void));
-int fgetNUL __P((char *, int, FILE *));
+void process(void);
+int main(int, char **);
+int match(const char *);
+int octdigit(char);
+void inithash(void);
+long hashit(const char *, char, long);
+void copystr(void);
+int fgetNUL(char *, int, FILE *);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
char addon = 0;
@@ -150,8 +148,7 @@
}
int
-match(ocp)
- const char *ocp;
+match(const char *ocp)
{
const char *cp;
int c;
@@ -233,8 +230,7 @@
}
int
-octdigit(c)
- char c;
+octdigit(char c)
{
return (c >= '0' && c <= '7');
@@ -262,16 +258,13 @@
} *bucket[NBUCKETS];
long
-hashit(str, really, fakept)
- char *str;
- char really;
- long fakept;
+hashit(const char *str, char really, long fakept)
{
int i;
struct hash *hp;
char buf[512];
long hashval = 0;
- char *cp;
+ const char *cp;
#ifdef __GNUC__
hp = NULL; /* XXX gcc */
@@ -315,10 +308,7 @@
#include <sys/stat.h>
int
-fgetNUL(obuf, rmdr, file)
- char *obuf;
- int rmdr;
- FILE *file;
+fgetNUL(char *obuf, int rmdr, FILE *file)
{
int c;
char *buf = obuf;
diff -r e268c31c8ec5 -r 1352d940b422 usr.bin/rpcinfo/rpcinfo.c
--- a/usr.bin/rpcinfo/rpcinfo.c Tue Nov 17 17:54:14 2009 +0000
+++ b/usr.bin/rpcinfo/rpcinfo.c Tue Nov 17 18:31:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rpcinfo.c,v 1.28 2009/04/13 07:04:54 lukem Exp $ */
+/* $NetBSD: rpcinfo.c,v 1.29 2009/11/17 18:31:13 drochner Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -123,11 +123,11 @@
#ifdef PORTMAP
-static void ip_ping(u_short, char *, int, char **);
+static void ip_ping(u_short, const char *, int, char **);
static CLIENT *clnt_com_create(struct sockaddr_in *, u_long, u_long, int *,
- char *);
+ const char *);
static void pmapdump(int, char **);
-static void get_inet_address(struct sockaddr_in *, char *);
+static void get_inet_address(struct sockaddr_in *, const char *);
#endif
static bool_t reply_proc(void *, struct netbuf *, struct netconfig *);
@@ -156,9 +156,7 @@
int main(int argc, char **argv);
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
register int c;
int errflg;
@@ -314,8 +312,7 @@
}
static CLIENT *
-local_rpcb(prog, vers)
- u_long prog, vers;
+local_rpcb(u_long prog, u_long vers)
{
struct netbuf nbuf;
struct sockaddr_un sun;
@@ -337,12 +334,8 @@
#ifdef PORTMAP
static CLIENT *
-clnt_com_create(addr, prog, vers, fdp, trans)
- struct sockaddr_in *addr;
- u_long prog;
- u_long vers;
- int *fdp;
- char *trans;
+clnt_com_create(struct sockaddr_in *addr, u_long prog, u_long vers,
+ int *fdp, const char *trans)
{
CLIENT *clnt;
@@ -375,11 +368,7 @@
* version 0 calls succeeds, it tries for MAXVERS call and repeats the same.
*/
static void
-ip_ping(portnum, trans, argc, argv)
- u_short portnum;
- char *trans;
- int argc;
- char **argv;
+ip_ping(u_short portnum, const char *trans, int argc, char **argv)
{
CLIENT *client;
int fd = RPC_ANYFD;
@@ -475,9 +464,7 @@
* Dump all the portmapper registerations
*/
static void
-pmapdump(argc, argv)
- int argc;
- char **argv;
+pmapdump(int argc, char **argv)
{
struct sockaddr_in server_addr;
struct pmaplist *head = NULL;
@@ -565,9 +552,7 @@
}
static void
-get_inet_address(addr, host)
- struct sockaddr_in *addr;
- char *host;
+get_inet_address(struct sockaddr_in *addr, const char *host)
{
struct netconfig *nconf;
struct addrinfo hints, *res;
diff -r e268c31c8ec5 -r 1352d940b422 usr.bin/xstr/xstr.c
--- a/usr.bin/xstr/xstr.c Tue Nov 17 17:54:14 2009 +0000
+++ b/usr.bin/xstr/xstr.c Tue Nov 17 18:31:12 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xstr.c,v 1.23 2009/04/14 09:18:41 lukem Exp $ */
+/* $NetBSD: xstr.c,v 1.24 2009/11/17 18:31:13 drochner Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)xstr.c 8.1 (Berkeley) 6/9/93";
#else
-__RCSID("$NetBSD: xstr.c,v 1.23 2009/04/14 09:18:41 lukem Exp $");
+__RCSID("$NetBSD: xstr.c,v 1.24 2009/11/17 18:31:13 drochner Exp $");
#endif
#endif /* not lint */
@@ -361,8 +361,7 @@
}
static int
-octdigit(c)
- char c;
+octdigit(char c)
{
return (isdigit((unsigned char)c) && c != '8' && c != '9');
Home |
Main Index |
Thread Index |
Old Index