kern: for pointers replace 0 with NULL.

These are mostly cosmetical, no functional change.

Found with devel/coccinelle.
This commit is contained in:
Pedro F. Giffuni 2016-04-15 16:10:11 +00:00
parent 59c3cb81c1
commit b85f65af68
17 changed files with 24 additions and 24 deletions

View File

@ -174,7 +174,7 @@ dumpsys_cb_dumpdata(struct dump_pa *mdp, int seqnr, void *arg)
error = 0; /* catch case in which chunk size is 0 */
counter = 0; /* Update twiddle every 16MB */
va = 0;
va = NULL;
pgs = mdp->pa_size / PAGE_SIZE;
pa = mdp->pa_start;
maxdumppgs = min(di->maxiosize / PAGE_SIZE, MAXDUMPPGS);

View File

@ -445,7 +445,7 @@ kproc_kthread_add(void (*func)(void *), void *arg,
char buf[100];
struct thread *td;
if (*procptr == 0) {
if (*procptr == NULL) {
error = kproc_create(func, arg,
procptr, flags, pages, "%s", procname);
if (error)

View File

@ -1444,7 +1444,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS)
p = LIST_FIRST(&allproc);
else
p = LIST_FIRST(&zombproc);
for (; p != 0; p = LIST_NEXT(p, p_list)) {
for (; p != NULL; p = LIST_NEXT(p, p_list)) {
/*
* Skip embryonic processes.
*/

View File

@ -912,7 +912,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
name++;
continue;
}
lsp2 = 0;
lsp2 = NULL;
SLIST_FOREACH(oid, lsp, oid_link) {
if (oid->oid_number != *name)
continue;
@ -1083,7 +1083,7 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS)
{
char *p;
int error, oid[CTL_MAXNAME], len = 0;
struct sysctl_oid *op = 0;
struct sysctl_oid *op = NULL;
struct rm_priotracker tracker;
if (!req->newlen)

View File

@ -1382,7 +1382,7 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value,
u_long diff = off;
u_long st_value;
const Elf_Sym* es;
const Elf_Sym* best = 0;
const Elf_Sym* best = NULL;
int i;
for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) {
@ -1400,7 +1400,7 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value,
}
}
}
if (best == 0)
if (best == NULL)
*diffp = off;
else
*diffp = diff;

View File

@ -1180,7 +1180,7 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value,
u_long diff = off;
u_long st_value;
const Elf_Sym *es;
const Elf_Sym *best = 0;
const Elf_Sym *best = NULL;
int i;
for (i = 0, es = ef->ddbsymtab; i < ef->ddbsymcnt; i++, es++) {
@ -1198,7 +1198,7 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value,
}
}
}
if (best == 0)
if (best == NULL)
*diffp = off;
else
*diffp = diff;

View File

@ -980,8 +980,8 @@ sys_semop(struct thread *td, struct semop_args *uap)
size_t nsops = uap->nsops;
struct sembuf *sops;
struct semid_kernel *semakptr;
struct sembuf *sopptr = 0;
struct sem *semptr = 0;
struct sembuf *sopptr = NULL;
struct sem *semptr = NULL;
struct sem_undo *suptr;
struct mtx *sema_mtxp;
size_t i, j, k;

View File

@ -459,7 +459,7 @@ m_copym(struct mbuf *m, int off0, int len, int wait)
m = m->m_next;
}
np = &top;
top = 0;
top = NULL;
while (len > 0) {
if (m == NULL) {
KASSERT(len == M_COPYALL,

View File

@ -593,7 +593,7 @@ sbappend_locked(struct sockbuf *sb, struct mbuf *m, int flags)
SOCKBUF_LOCK_ASSERT(sb);
if (m == 0)
if (m == NULL)
return;
sbm_clrprotoflags(m, flags);
SBLASTRECORDCHK(sb);
@ -746,7 +746,7 @@ sbappendrecord_locked(struct sockbuf *sb, struct mbuf *m0)
SOCKBUF_LOCK_ASSERT(sb);
if (m0 == 0)
if (m0 == NULL)
return;
m_clrprotoflags(m0);
/*
@ -885,7 +885,7 @@ sbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0,
SOCKBUF_LOCK_ASSERT(sb);
if (control == 0)
if (control == NULL)
panic("sbappendcontrol_locked");
space = m_length(control, &n) + m_length(m0, NULL);

View File

@ -430,7 +430,7 @@ kern_accept4(struct thread *td, int s, struct sockaddr **name,
(void) fo_ioctl(nfp, FIONBIO, &tmp, td->td_ucred, td);
tmp = fflag & FASYNC;
(void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td);
sa = 0;
sa = NULL;
error = soaccept(so, &sa);
if (error != 0)
goto noconnection;

View File

@ -368,7 +368,7 @@ cluster_rbuild(struct vnode *vp, u_quad_t filesize, daddr_t lbn,
return tbp;
bp = trypbuf(&cluster_pbuf_freecnt);
if (bp == 0)
if (bp == NULL)
return tbp;
/*

View File

@ -102,7 +102,7 @@ vfs_hang_addrlist(struct mount *mp, struct netexport *nep,
register struct radix_node_head *rnh;
register int i;
struct radix_node *rn;
struct sockaddr *saddr, *smask = 0;
struct sockaddr *saddr, *smask = NULL;
#if defined(INET6) || defined(INET)
int off;
#endif

View File

@ -486,7 +486,7 @@ int
lookup(struct nameidata *ndp)
{
char *cp; /* pointer into pathname argument */
struct vnode *dp = 0; /* the directory we are searching */
struct vnode *dp = NULL; /* the directory we are searching */
struct vnode *tdp; /* saved dp */
struct mount *mp; /* mount table entry */
struct prison *pr;
@ -949,7 +949,7 @@ lookup(struct nameidata *ndp)
int
relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
{
struct vnode *dp = 0; /* the directory we are searching */
struct vnode *dp = NULL; /* the directory we are searching */
int wantparent; /* 1 => wantparent or lockparent flag */
int rdonly; /* lookup read-only flag bit */
int error = 0;

View File

@ -123,7 +123,7 @@ strtol(nptr, endptr, base)
acc = neg ? LONG_MIN : LONG_MAX;
} else if (neg)
acc = -acc;
if (endptr != 0)
if (endptr != NULL)
*endptr = __DECONST(char *, any ? s - 1 : nptr);
return (acc);
}

View File

@ -124,7 +124,7 @@ strtoq(const char *nptr, char **endptr, int base)
acc = neg ? QUAD_MIN : QUAD_MAX;
} else if (neg)
acc = -acc;
if (endptr != 0)
if (endptr != NULL)
*endptr = __DECONST(char *, any ? s - 1 : nptr);
return (acc);
}

View File

@ -102,7 +102,7 @@ strtoul(nptr, endptr, base)
acc = ULONG_MAX;
} else if (neg)
acc = -acc;
if (endptr != 0)
if (endptr != NULL)
*endptr = __DECONST(char *, any ? s - 1 : nptr);
return (acc);
}

View File

@ -101,7 +101,7 @@ strtouq(const char *nptr, char **endptr, int base)
acc = UQUAD_MAX;
} else if (neg)
acc = -acc;
if (endptr != 0)
if (endptr != NULL)
*endptr = __DECONST(char *, any ? s - 1 : nptr);
return (acc);
}