Catch a few places where NULL (pointer) was used where 0 (integer) was

expected.
This commit is contained in:
Peter Wemm 2003-12-23 02:36:43 +00:00
parent 98ef6ed422
commit a89ec05e3e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123740
14 changed files with 28 additions and 29 deletions

View File

@ -99,7 +99,7 @@ static struct special_symbol {
{ (uintptr_t)&XentSys, "syscall" },
{ (uintptr_t)&XentUna, "unaligned access fault" },
{ (uintptr_t)&XentRestart, "console restart" },
{ NULL }
{ 0, NULL }
};
@ -180,7 +180,7 @@ sym_is_trapsymbol(uintptr_t v)
{
int i;
for (i = 0; special_symbols[i].ss_val != NULL; ++i)
for (i = 0; special_symbols[i].ss_val != 0; ++i)
if (v == special_symbols[i].ss_val)
return 1;
return 0;
@ -339,7 +339,7 @@ db_stack_trace_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *m
if (sym_is_trapsymbol(symval)) {
tf = (struct trapframe *)frame;
for (i = 0; special_symbols[i].ss_val != NULL; ++i)
for (i = 0; special_symbols[i].ss_val != 0; ++i)
if (symval == special_symbols[i].ss_val)
db_printf("--- %s",
special_symbols[i].ss_note);

View File

@ -88,7 +88,7 @@ dumpsys(struct dumperinfo *di)
dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE;
dumplo -= sizeof kdh * 2;
i = di->dumper(di->priv, &kdh, NULL, dumplo, sizeof kdh);
i = di->dumper(di->priv, &kdh, 0, dumplo, sizeof kdh);
if (i)
printf("\nDump failed writing header (%d)\n", i);
dumplo += sizeof kdh;
@ -111,7 +111,7 @@ dumpsys(struct dumperinfo *di)
printf(" %d", count / (1024 * 1024 / PAGE_SIZE));
mb = i;
}
i = di->dumper(di->priv, va, NULL, dumplo, left * PAGE_SIZE);
i = di->dumper(di->priv, va, 0, dumplo, left * PAGE_SIZE);
if (i)
break;
count += left;
@ -120,10 +120,10 @@ dumpsys(struct dumperinfo *di)
}
if (i)
printf("\nDump failed writing data (%d)\n", i);
i = di->dumper(di->priv, &kdh, NULL, dumplo, sizeof kdh);
i = di->dumper(di->priv, &kdh, 0, dumplo, sizeof kdh);
if (i)
printf("\nDump failed writing trailer (%d)\n", i);
di->dumper(di->priv, NULL, NULL, 0, 0); /* tell them we are done */
di->dumper(di->priv, NULL, 0, 0, 0); /* tell them we are done */
printf("\nDump complete\n");
return;
}

View File

@ -292,7 +292,7 @@ apecs_attach(device_t dev)
sc->smem_base = APECS_PCI_SPARSE;
sc->io_base = APECS_PCI_SIO;
sc->cfg0_base = KV(APECS_PCI_CONF);
sc->cfg1_base = NULL;
sc->cfg1_base = 0;
set_iointr(alpha_dispatch_intr);

View File

@ -1314,7 +1314,7 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
{
int err = 0;
int idb, z, i, dmach = 0, ldesc;
u_int32_t off = NULL;
u_int32_t off = 0;
struct fwohcidb_tr *db_tr;
struct fwohcidb *db;
@ -1329,7 +1329,7 @@ fwohci_tx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
break;
}
}
if(off == NULL){
if(off == 0){
err = EINVAL;
return err;
}
@ -1373,7 +1373,7 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
{
int err = 0;
int idb, z, i, dmach = 0, ldesc;
u_int32_t off = NULL;
u_int32_t off = 0;
struct fwohcidb_tr *db_tr;
struct fwohcidb *db;
@ -1390,7 +1390,7 @@ fwohci_rx_enable(struct fwohci_softc *sc, struct fwohci_dbch *dbch)
}
}
}
if(off == NULL){
if(off == 0){
err = EINVAL;
return err;
}

View File

@ -136,9 +136,9 @@ pcigfb_attach(device_t dev)
adp->va_mem_base = (vm_offset_t)rman_get_virtual(sc->res);
adp->va_mem_size = rman_get_end(sc->res) -
rman_get_start(sc->res);
adp->va_io_base = NULL;
adp->va_io_base = 0;
adp->va_io_size = 0;
adp->va_crtc_addr = NULL;
adp->va_crtc_addr = 0;
gfb_device_softcs[sc->model][unit] = sc;
sc->gfbc = (struct gfb_conf *)malloc(sizeof(struct gfb_conf),
M_DEVBUF, M_NOWAIT);

View File

@ -474,7 +474,7 @@ mpt_dma_mem_alloc(mpt_softc_t *mpt)
device_t dev = mpt->dev;
/* Check if we alreay have allocated the reply memory */
if (mpt->reply_phys != NULL) {
if (mpt->reply_phys != 0) {
return 0;
}

View File

@ -359,7 +359,7 @@ stopprofclock(p)
p->p_flag |= P_STOPPROF;
while (p->p_profthreads != 0)
msleep(&p->p_profthreads, &p->p_mtx, PPAUSE,
"stopprof", NULL);
"stopprof", 0);
p->p_flag &= ~P_STOPPROF;
}
mtx_lock_spin(&sched_lock);

View File

@ -897,7 +897,7 @@ m_defrag(struct mbuf *m0, int how)
if (m_final == NULL)
goto nospace;
if (m_dup_pkthdr(m_final, m0, how) == NULL)
if (m_dup_pkthdr(m_final, m0, how) == 0)
goto nospace;
m_new = m_final;

View File

@ -463,7 +463,7 @@ ip_fastforward(struct mbuf *m)
if (!ipstealth) {
#endif
if (ip->ip_ttl <= IPTTLDEC) {
icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, NULL, NULL);
icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, 0, NULL);
return 1;
}
@ -503,7 +503,7 @@ ip_fastforward(struct mbuf *m)
} else {
ipstat.ips_noroute++;
ipstat.ips_cantforward++;
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, NULL, NULL);
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, NULL);
if (ro.ro_rt)
RTFREE(ro.ro_rt);
return 1;
@ -707,8 +707,7 @@ ip_fastforward(struct mbuf *m)
} else {
ipstat.ips_noroute++;
ipstat.ips_cantforward++;
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST,
NULL, NULL);
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, NULL);
if (ro.ro_rt)
RTFREE(ro.ro_rt);
return 1;
@ -750,7 +749,7 @@ ip_fastforward(struct mbuf *m)
*/
if (ip->ip_off & IP_DF) {
icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG,
NULL, ifp);
0, ifp);
ipstat.ips_cantfrag++;
RTFREE(ro.ro_rt);
return 1;

View File

@ -640,7 +640,7 @@ in6_selectroute(dstsock, opts, mopts, ro, retifp, retrt, clone)
rtalloc((struct route *)ro);
} else {
ro->ro_rt = rtalloc1(&((struct route *)ro)
->ro_dst, NULL, 0UL);
->ro_dst, 0, 0UL);
if (ro->ro_rt)
RT_UNLOCK(ro->ro_rt);
}

View File

@ -1857,7 +1857,7 @@ pim6_input(mp, offp, proto)
#endif
rc = if_simloop(mif6table[reg_mif_num].m6_ifp, m,
dst.sin6_family, NULL);
dst.sin6_family, 0);
/* prepare the register head to send to the mrouting daemon */
m = mcp;

View File

@ -1481,10 +1481,10 @@ ip6_ctloutput(so, sopt)
struct mbuf *m;
error = soopt_getm(sopt, &m); /* XXX */
if (error != NULL)
if (error != 0)
break;
error = soopt_mcopyin(sopt, m); /* XXX */
if (error != NULL)
if (error != 0)
break;
error = ip6_pcbopts(&in6p->in6p_outputopts,
m, so, sopt);
@ -3405,7 +3405,7 @@ ip6_mloopback(ifp, m, dst)
in6_clearscope(&ip6->ip6_src);
in6_clearscope(&ip6->ip6_dst);
(void)if_simloop(ifp, copym, dst->sin6_family, NULL);
(void)if_simloop(ifp, copym, dst->sin6_family, 0);
}
/*

View File

@ -170,7 +170,7 @@ static struct rl_type rl_devs[] = {
"LevelOne FPC-0106TX" },
{ EDIMAX_VENDORID, EDIMAX_DEVICEID_EP4103DL, RL_8139,
"Edimax EP-4103DL CardBus" },
{ 0, 0, NULL }
{ 0, 0, 0, NULL }
};
static int rl_probe (device_t);

View File

@ -34,7 +34,7 @@
* See pthread_*
*/
#define UMTX_UNOWNED NULL
#define UMTX_UNOWNED 0x0
#define UMTX_CONTESTED 0x1