Spell "(struct foo *)0" as "NULL".

This commit is contained in:
Robert Watson 2004-03-21 03:28:08 +00:00
parent c707fea10b
commit 97cb84c481
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=127255
4 changed files with 23 additions and 25 deletions

View file

@ -50,7 +50,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
struct netrange *nr;
struct at_aliasreq *ifra = (struct at_aliasreq *)data;
struct at_ifaddr *aa0;
struct at_ifaddr *aa = 0;
struct at_ifaddr *aa = NULL;
struct ifaddr *ifa, *ifa0;
/*
@ -90,7 +90,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
* If we a retrying to delete an addres but didn't find such,
* then rewurn with an error
*/
if ( cmd == SIOCDIFADDR && aa == 0 ) {
if ( cmd == SIOCDIFADDR && aa == NULL ) {
return( EADDRNOTAVAIL );
}
/*FALLTHROUGH*/
@ -130,14 +130,14 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
}
}
if ( ifp == 0 )
if ( ifp == NULL )
panic( "at_control" );
/*
* If we failed to find an existing at_ifaddr entry, then we
* allocate a fresh one.
*/
if ( aa == (struct at_ifaddr *) 0 ) {
if ( aa == NULL ) {
aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, M_WAITOK | M_ZERO);
if (( aa = at_ifaddr ) != NULL ) {
/*
@ -224,7 +224,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
}
}
if ( aa == (struct at_ifaddr *) 0 )
if ( aa == NULL )
return( EADDRNOTAVAIL );
break;
}
@ -301,7 +301,7 @@ at_control(struct socket *so, u_long cmd, caddr_t data,
break;
default:
if ( ifp == 0 || ifp->if_ioctl == 0 )
if ( ifp == NULL || ifp->if_ioctl == NULL )
return( EOPNOTSUPP );
return( (*ifp->if_ioctl)( ifp, cmd, data ));
}

View file

@ -56,7 +56,7 @@ at1intr(struct mbuf *m)
/*
* Phase 1 packet handling
*/
if (m->m_len < SZ_ELAPHDR && ((m = m_pullup(m, SZ_ELAPHDR)) == 0)) {
if (m->m_len < SZ_ELAPHDR && ((m = m_pullup(m, SZ_ELAPHDR)) == NULL)) {
ddpstat.ddps_tooshort++;
return;
}
@ -105,7 +105,7 @@ ddp_input( m, ifp, elh, phase )
ddpstat.ddps_short++;
if ( m->m_len < sizeof( struct ddpshdr ) &&
(( m = m_pullup( m, sizeof( struct ddpshdr ))) == 0 )) {
(( m = m_pullup( m, sizeof( struct ddpshdr ))) == NULL )) {
ddpstat.ddps_tooshort++;
return;
}
@ -151,7 +151,7 @@ ddp_input( m, ifp, elh, phase )
ddpstat.ddps_long++;
if ( m->m_len < sizeof( struct ddpehdr ) &&
(( m = m_pullup( m, sizeof( struct ddpehdr ))) == 0 )) {
(( m = m_pullup( m, sizeof( struct ddpehdr ))) == NULL )) {
ddpstat.ddps_tooshort++;
return;
}
@ -280,7 +280,7 @@ ddp_input( m, ifp, elh, phase )
&& ( satosat(&forwro.ro_dst)->sat_addr.s_net != to.sat_addr.s_net
|| satosat(&forwro.ro_dst)->sat_addr.s_node != to.sat_addr.s_node )) {
RTFREE( forwro.ro_rt );
forwro.ro_rt = (struct rtentry *)0;
forwro.ro_rt = NULL;
}
/*
@ -288,8 +288,7 @@ ddp_input( m, ifp, elh, phase )
* Then get a new route.
* XXX this could cause a 'route leak'. check this!
*/
if ( forwro.ro_rt == (struct rtentry *)0
|| forwro.ro_rt->rt_ifp == (struct ifnet *)0 ) {
if ( forwro.ro_rt == NULL || forwro.ro_rt->rt_ifp == NULL ) {
forwro.ro_dst.sa_len = sizeof( struct sockaddr_at );
forwro.ro_dst.sa_family = AF_APPLETALK;
satosat(&forwro.ro_dst)->sat_addr.s_net = to.sat_addr.s_net;
@ -377,7 +376,7 @@ ddp_input( m, ifp, elh, phase )
* If we found one, deliver th epacket to the socket
*/
if ( sbappendaddr( &ddp->ddp_socket->so_rcv, (struct sockaddr *)&from,
m, (struct mbuf *)0 ) == 0 ) {
m, NULL ) == 0 ) {
/*
* If the socket is full (or similar error) dump the packet.
*/

View file

@ -199,7 +199,7 @@ ddp_route( struct mbuf *m, struct route *ro)
*/
if ( !(aa->aa_flags & AFA_PHASE2) ) {
MGET( m0, M_TRYWAIT, MT_HEADER );
if ( m0 == 0 ) {
if ( m0 == NULL ) {
m_freem( m );
printf("ddp_route: no buffers\n");
return( ENOBUFS );

View file

@ -42,7 +42,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
return( EINVAL );
}
if (addr != 0) { /* validate passed address */
if (addr != NULL) { /* validate passed address */
sat = (struct sockaddr_at *)addr;
if (sat->sat_family != AF_APPLETALK) {
return(EAFNOSUPPORT);
@ -95,7 +95,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
if ( sat->sat_port == ATADDR_ANYPORT ) {
for ( sat->sat_port = ATPORT_RESERVED;
sat->sat_port < ATPORT_LAST; sat->sat_port++ ) {
if ( ddp_ports[ sat->sat_port - 1 ] == 0 ) {
if ( ddp_ports[ sat->sat_port - 1 ] == NULL ) {
break;
}
}
@ -130,7 +130,7 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
{
struct sockaddr_at *sat = (struct sockaddr_at *)addr;
struct route *ro;
struct at_ifaddr *aa = 0;
struct at_ifaddr *aa = NULL;
struct ifnet *ifp;
u_short hintnet = 0, net;
@ -163,7 +163,7 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
} else {
net = sat->sat_addr.s_net;
}
aa = 0;
aa = NULL;
if ((ifp = ro->ro_rt->rt_ifp) != NULL) {
for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
if ( aa->aa_ifp == ifp &&
@ -178,15 +178,14 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
satosat( &ro->ro_dst )->sat_addr.s_node !=
sat->sat_addr.s_node )) {
RTFREE( ro->ro_rt );
ro->ro_rt = (struct rtentry *)0;
ro->ro_rt = NULL;
}
}
/*
* If we've got no route for this interface, try to find one.
*/
if ( ro->ro_rt == (struct rtentry *)0 ||
ro->ro_rt->rt_ifp == (struct ifnet *)0 ) {
if ( ro->ro_rt == NULL || ro->ro_rt->rt_ifp == NULL ) {
ro->ro_dst.sa_len = sizeof( struct sockaddr_at );
ro->ro_dst.sa_family = AF_APPLETALK;
if ( hintnet ) {
@ -201,7 +200,7 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
/*
* Make sure any route that we have has a valid interface.
*/
aa = 0;
aa = NULL;
if ( ro->ro_rt && ( ifp = ro->ro_rt->rt_ifp )) {
for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
if ( aa->aa_ifp == ifp ) {
@ -209,13 +208,13 @@ at_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, struct thread *td)
}
}
}
if ( aa == 0 ) {
if ( aa == NULL ) {
return( ENETUNREACH );
}
ddp->ddp_fsat = *sat;
if ( ddp->ddp_lsat.sat_port == ATADDR_ANYPORT ) {
return(at_pcbsetaddr(ddp, (struct sockaddr *)0, td));
return(at_pcbsetaddr(ddp, NULL, td));
}
return( 0 );
}
@ -254,7 +253,7 @@ void
at_pcbdetach( struct socket *so, struct ddpcb *ddp)
{
soisdisconnected( so );
so->so_pcb = 0;
so->so_pcb = NULL;
sotryfree(so);
/* remove ddp from ddp_ports list */