diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-01-08 19:17:40 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-01-08 19:17:40 +0000 |
commit | 9d48f0b4377bbf84840e8fbf85ba84a92db4f1e4 (patch) | |
tree | aae3660c202da026f6993767c142e9f2ab3ee497 /lib | |
parent | dbec8a37e99faa88941367bebac8d593f2a646c3 (diff) |
Bit of KNF - replace (<type> *)0 and (<type> *)NULL with NULL. Pointed
out by mickey@, seconded by millert@.
ok deraadt@.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/rpc/auth_unix.c | 8 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_tcp.c | 12 | ||||
-rw-r--r-- | lib/libc/rpc/clnt_udp.c | 8 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_clnt.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_getmaps.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_getport.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/pmap_rmt.c | 4 | ||||
-rw-r--r-- | lib/libc/rpc/rpc_prot.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/svc.c | 19 | ||||
-rw-r--r-- | lib/libc/rpc/svc_tcp.c | 12 | ||||
-rw-r--r-- | lib/libc/rpc/svc_udp.c | 6 | ||||
-rw-r--r-- | lib/libc/rpc/xdr.c | 6 |
12 files changed, 48 insertions, 49 deletions
diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c index b63894f9473..7f2c4d0abfa 100644 --- a/lib/libc/rpc/auth_unix.c +++ b/lib/libc/rpc/auth_unix.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: auth_unix.c,v 1.16 2003/09/20 00:39:39 deraadt Exp $"; +static char *rcsid = "$OpenBSD: auth_unix.c,v 1.17 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -131,7 +131,7 @@ authunix_create(machname, uid, gid, len, aup_gids) /* * fill in param struct from the given params */ - (void)gettimeofday(&now, (struct timezone *)0); + (void)gettimeofday(&now, NULL); aup.aup_time = now.tv_sec; aup.aup_machname = machname; aup.aup_uid = uid; @@ -263,7 +263,7 @@ authunix_refresh(auth) /* first deserialize the creds back into a struct authunix_parms */ aup.aup_machname = NULL; - aup.aup_gids = (int *)NULL; + aup.aup_gids = NULL; xdrmem_create(&xdrs, au->au_origcred.oa_base, au->au_origcred.oa_length, XDR_DECODE); stat = xdr_authunix_parms(&xdrs, &aup); @@ -271,7 +271,7 @@ authunix_refresh(auth) goto done; /* update the time and serialize in place */ - (void)gettimeofday(&now, (struct timezone *)0); + (void)gettimeofday(&now, NULL); aup.aup_time = now.tv_sec; xdrs.x_op = XDR_ENCODE; XDR_SETPOS(&xdrs, 0); diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c index c2110224df0..a2b95644a2f 100644 --- a/lib/libc/rpc/clnt_tcp.c +++ b/lib/libc/rpc/clnt_tcp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: clnt_tcp.c,v 1.19 2003/12/31 03:27:23 millert Exp $"; +static char *rcsid = "$OpenBSD: clnt_tcp.c,v 1.20 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -145,7 +145,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) if ((port = pmap_getport(raddr, prog, vers, IPPROTO_TCP)) == 0) { mem_free((caddr_t)ct, sizeof(struct ct_data)); mem_free((caddr_t)h, sizeof(CLIENT)); - return ((CLIENT *)NULL); + return (NULL); } raddr->sin_port = htons(port); } @@ -155,7 +155,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) */ if (*sockp < 0) { *sockp = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - (void)bindresvport(*sockp, (struct sockaddr_in *)0); + (void)bindresvport(*sockp, NULL); if ((*sockp < 0) || (connect(*sockp, (struct sockaddr *)raddr, sizeof(*raddr)) < 0)) { @@ -181,7 +181,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz) /* * Initialize call message */ - (void)gettimeofday(&now, (struct timezone *)0); + (void)gettimeofday(&now, NULL); call_msg.rm_xid = arc4random(); call_msg.rm_direction = CALL; call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; @@ -221,7 +221,7 @@ fooy: mem_free((caddr_t)ct, sizeof(struct ct_data)); if (h) mem_free((caddr_t)h, sizeof(CLIENT)); - return ((CLIENT *)NULL); + return (NULL); } static enum clnt_stat @@ -247,7 +247,7 @@ clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout) } shipnow = - (xdr_results == (xdrproc_t)0 && timeout.tv_sec == 0 + (xdr_results == NULL && timeout.tv_sec == 0 && timeout.tv_usec == 0) ? FALSE : TRUE; call_again: diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c index 40fcc669961..53ceb86ff12 100644 --- a/lib/libc/rpc/clnt_udp.c +++ b/lib/libc/rpc/clnt_udp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: clnt_udp.c,v 1.20 2003/12/31 03:27:23 millert Exp $"; +static char *rcsid = "$OpenBSD: clnt_udp.c,v 1.21 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -136,7 +136,7 @@ clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) } cu->cu_outbuf = &cu->cu_inbuf[recvsz]; - (void)gettimeofday(&now, (struct timezone *)0); + (void)gettimeofday(&now, NULL); if (raddr->sin_port == 0) { u_short port; if ((port = @@ -175,7 +175,7 @@ clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) goto fooy; } /* attempt to bind to priv port */ - (void)bindresvport(*sockp, (struct sockaddr_in *)0); + (void)bindresvport(*sockp, NULL); /* the sockets rpc controls are non-blocking */ (void)ioctl(*sockp, FIONBIO, (char *) &dontblock); cu->cu_closeit = TRUE; @@ -190,7 +190,7 @@ fooy: mem_free((caddr_t)cu, sizeof(*cu) + sendsz + recvsz); if (cl) mem_free((caddr_t)cl, sizeof(CLIENT)); - return ((CLIENT *)NULL); + return (NULL); } CLIENT * diff --git a/lib/libc/rpc/pmap_clnt.c b/lib/libc/rpc/pmap_clnt.c index f7df2520434..281728e236e 100644 --- a/lib/libc/rpc/pmap_clnt.c +++ b/lib/libc/rpc/pmap_clnt.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_clnt.c,v 1.12 2002/08/29 22:47:15 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_clnt.c,v 1.13 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -69,7 +69,7 @@ pmap_set(program, version, protocol, port) myaddress.sin_addr.s_addr = htonl(INADDR_LOOPBACK); client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS, timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); - if (client == (CLIENT *)NULL) + if (client == NULL) return (FALSE); parms.pm_prog = program; parms.pm_vers = version; @@ -109,7 +109,7 @@ pmap_unset(program, version) myaddress.sin_addr.s_addr = htonl(INADDR_LOOPBACK); client = clntudp_bufcreate(&myaddress, PMAPPROG, PMAPVERS, timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); - if (client == (CLIENT *)NULL) + if (client == NULL) return (FALSE); parms.pm_prog = program; parms.pm_vers = version; diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c index 7ff09386a27..77918130e28 100644 --- a/lib/libc/rpc/pmap_getmaps.c +++ b/lib/libc/rpc/pmap_getmaps.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_getmaps.c,v 1.7 2001/09/15 13:51:00 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_getmaps.c,v 1.8 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -60,7 +60,7 @@ struct pmaplist * pmap_getmaps(address) struct sockaddr_in *address; { - struct pmaplist *head = (struct pmaplist *)NULL; + struct pmaplist *head = NULL; int sock = -1; struct timeval minutetimeout; CLIENT *client; @@ -70,7 +70,7 @@ pmap_getmaps(address) address->sin_port = htons(PMAPPORT); client = clnttcp_create(address, PMAPPROG, PMAPVERS, &sock, 50, 500); - if (client != (CLIENT *)NULL) { + if (client != NULL) { if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist, &head, minutetimeout) != RPC_SUCCESS) { clnt_perror(client, "pmap_getmaps rpc problem"); diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c index 5cfb63a8863..be841822fd9 100644 --- a/lib/libc/rpc/pmap_getport.c +++ b/lib/libc/rpc/pmap_getport.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_getport.c,v 1.7 2001/09/15 13:51:01 deraadt Exp $"; +static char *rcsid = "$OpenBSD: pmap_getport.c,v 1.8 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -68,7 +68,7 @@ pmap_getport(address, program, version, protocol) address->sin_port = htons(PMAPPORT); client = clntudp_bufcreate(address, PMAPPROG, PMAPVERS, timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); - if (client != (CLIENT *)NULL) { + if (client != NULL) { parms.pm_prog = program; parms.pm_vers = version; parms.pm_prot = protocol; diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c index 0413676ce84..7aaec648e4f 100644 --- a/lib/libc/rpc/pmap_rmt.c +++ b/lib/libc/rpc/pmap_rmt.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: pmap_rmt.c,v 1.22 2004/12/17 03:24:20 krw Exp $"; +static char *rcsid = "$OpenBSD: pmap_rmt.c,v 1.23 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -82,7 +82,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt addr->sin_port = htons(PMAPPORT); client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &sock); - if (client != (CLIENT *)NULL) { + if (client != NULL) { a.prog = prog; a.vers = vers; a.proc = proc; diff --git a/lib/libc/rpc/rpc_prot.c b/lib/libc/rpc/rpc_prot.c index 636f0629857..a53bd254c4c 100644 --- a/lib/libc/rpc/rpc_prot.c +++ b/lib/libc/rpc/rpc_prot.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: rpc_prot.c,v 1.7 2001/09/15 13:51:01 deraadt Exp $"; +static char *rcsid = "$OpenBSD: rpc_prot.c,v 1.8 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -135,7 +135,7 @@ xdr_rejected_reply(xdrs, rr) static struct xdr_discrim reply_dscrm[3] = { { (int)MSG_ACCEPTED, xdr_accepted_reply }, { (int)MSG_DENIED, xdr_rejected_reply }, - { __dontcare__, NULL_xdrproc_t } }; + { __dontcare__, NULL } }; /* * XDR a reply message @@ -149,7 +149,7 @@ xdr_replymsg(xdrs, rmsg) xdr_enum(xdrs, (enum_t *)&(rmsg->rm_direction)) && rmsg->rm_direction == REPLY) return (xdr_union(xdrs, (enum_t *)&(rmsg->rm_reply.rp_stat), - (caddr_t)&(rmsg->rm_reply.ru), reply_dscrm, NULL_xdrproc_t)); + (caddr_t)&(rmsg->rm_reply.ru), reply_dscrm, NULL)); return (FALSE); } diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c index efe828394e8..e973f4706ce 100644 --- a/lib/libc/rpc/svc.c +++ b/lib/libc/rpc/svc.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: svc.c,v 1.16 2003/12/31 03:27:23 millert Exp $"; +static char *rcsid = "$OpenBSD: svc.c,v 1.17 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -51,7 +51,6 @@ static char *rcsid = "$OpenBSD: svc.c,v 1.16 2003/12/31 03:27:23 millert Exp $"; static SVCXPRT **xports; static int xportssize; -#define NULL_SVC ((struct svc_callout *)0) #define RQCRED_SIZE 400 /* this size is excessive */ #define max(a, b) (a > b ? a : b) @@ -305,13 +304,13 @@ svc_register(xprt, prog, vers, dispatch, protocol) struct svc_callout *prev; struct svc_callout *s; - if ((s = svc_find(prog, vers, &prev)) != NULL_SVC) { + if ((s = svc_find(prog, vers, &prev)) != NULL) { if (s->sc_dispatch == dispatch) goto pmap_it; /* he is registering another xptr */ return (FALSE); } s = (struct svc_callout *)mem_alloc(sizeof(struct svc_callout)); - if (s == (struct svc_callout *)0) { + if (s == NULL) { return (FALSE); } s->sc_prog = prog; @@ -338,14 +337,14 @@ svc_unregister(prog, vers) struct svc_callout *prev; struct svc_callout *s; - if ((s = svc_find(prog, vers, &prev)) == NULL_SVC) + if ((s = svc_find(prog, vers, &prev)) == NULL) return; - if (prev == NULL_SVC) { + if (prev == NULL) { svc_head = s->sc_next; } else { prev->sc_next = s->sc_next; } - s->sc_next = NULL_SVC; + s->sc_next = NULL; mem_free((char *) s, (u_int) sizeof(struct svc_callout)); /* now unregister the information with the local binder service */ (void)pmap_unset(prog, vers); @@ -363,8 +362,8 @@ svc_find(prog, vers, prev) { struct svc_callout *s, *p; - p = NULL_SVC; - for (s = svc_head; s != NULL_SVC; s = s->sc_next) { + p = NULL; + for (s = svc_head; s != NULL; s = s->sc_next) { if ((s->sc_prog == prog) && (s->sc_vers == vers)) goto done; p = s; @@ -620,7 +619,7 @@ svc_getreq_common(fd) prog_found = FALSE; low_vers = (u_long) -1; high_vers = 0; - for (s = svc_head; s != NULL_SVC; s = s->sc_next) { + for (s = svc_head; s != NULL; s = s->sc_next) { if (s->sc_prog == r.rq_prog) { if (s->sc_vers == r.rq_vers) { (*s->sc_dispatch)(&r, xprt); diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index 97938d66a1b..22df9815e87 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.23 2003/12/31 03:27:23 millert Exp $"; +static char *rcsid = "$OpenBSD: svc_tcp.c,v 1.24 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -138,7 +138,7 @@ svctcp_create(sock, sendsize, recvsize) if (sock == RPC_ANYSOCK) { if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { perror("svctcp_.c - udp socket creation problem"); - return ((SVCXPRT *)NULL); + return (NULL); } madesock = TRUE; } @@ -154,7 +154,7 @@ svctcp_create(sock, sendsize, recvsize) perror("svctcp_.c - cannot getsockname or listen"); if (madesock) (void)close(sock); - return ((SVCXPRT *)NULL); + return (NULL); } r = (struct tcp_rendezvous *)mem_alloc(sizeof(*r)); if (r == NULL) { @@ -213,15 +213,15 @@ makefd_xprt(fd, sendsize, recvsize) struct tcp_conn *cd; xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT)); - if (xprt == (SVCXPRT *)NULL) { + if (xprt == NULL) { (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n"); goto done; } cd = (struct tcp_conn *)mem_alloc(sizeof(struct tcp_conn)); - if (cd == (struct tcp_conn *)NULL) { + if (cd == NULL) { (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n"); mem_free((char *) xprt, sizeof(SVCXPRT)); - xprt = (SVCXPRT *)NULL; + xprt = NULL; goto done; } cd->strm_stat = XPRT_IDLE; diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c index 5c5ed600d89..fc1b94bd03f 100644 --- a/lib/libc/rpc/svc_udp.c +++ b/lib/libc/rpc/svc_udp.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: svc_udp.c,v 1.13 2003/09/20 00:40:36 deraadt Exp $"; +static char *rcsid = "$OpenBSD: svc_udp.c,v 1.14 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -108,7 +108,7 @@ svcudp_bufcreate(sock, sendsz, recvsz) if (sock == RPC_ANYSOCK) { if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { perror("svcudp_create: socket creation problem"); - return ((SVCXPRT *)NULL); + return (NULL); } madesock = TRUE; } @@ -123,7 +123,7 @@ svcudp_bufcreate(sock, sendsz, recvsz) perror("svcudp_create - cannot getsockname"); if (madesock) (void)close(sock); - return ((SVCXPRT *)NULL); + return (NULL); } xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT)); if (xprt == NULL) { diff --git a/lib/libc/rpc/xdr.c b/lib/libc/rpc/xdr.c index efd9cfee4cb..071bff4313a 100644 --- a/lib/libc/rpc/xdr.c +++ b/lib/libc/rpc/xdr.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: xdr.c,v 1.6 2001/09/15 13:51:01 deraadt Exp $"; +static char *rcsid = "$OpenBSD: xdr.c,v 1.7 2005/01/08 19:17:39 krw Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -617,7 +617,7 @@ xdr_union(xdrs, dscmp, unp, choices, dfault) * search choices for a value that matches the discriminator. * if we find one, execute the xdr routine for that value. */ - for (; choices->proc != NULL_xdrproc_t; choices++) { + for (; choices->proc != NULL; choices++) { if (choices->value == dscm) return ((*(choices->proc))(xdrs, unp)); } @@ -625,7 +625,7 @@ xdr_union(xdrs, dscmp, unp, choices, dfault) /* * no match - execute the default xdr routine if there is one */ - return ((dfault == NULL_xdrproc_t) ? FALSE : + return ((dfault == NULL) ? FALSE : (*dfault)(xdrs, unp)); } |