sys: Replace zero with NULL for pointers.

Found with:	devel/coccinelle
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D9694
This commit is contained in:
Pedro F. Giffuni 2017-02-22 02:35:59 +00:00
parent dae82c37b0
commit e099b90b80
18 changed files with 28 additions and 28 deletions

View File

@ -1044,7 +1044,7 @@ db_read_address(loc, short_addr, rex, regmodrm, addrp)
return (loc);
}
addrp->is_reg = FALSE;
addrp->index = 0;
addrp->index = NULL;
if (short_addr)
size = LONG;
@ -1067,7 +1067,7 @@ db_read_address(loc, short_addr, rex, regmodrm, addrp)
if (rm == 5) {
get_value_inc(addrp->disp, loc, 4, FALSE);
if (have_sib)
addrp->base = 0;
addrp->base = NULL;
else if (short_addr)
addrp->base = "%eip";
else
@ -1109,9 +1109,9 @@ db_print_address(seg, size, rex, addrp)
db_printf("%s:", seg);
}
if (addrp->disp != 0 || (addrp->base == 0 && addrp->index == 0))
if (addrp->disp != 0 || (addrp->base == NULL && addrp->index == NULL))
db_printsym((db_addr_t)addrp->disp, DB_STGY_ANY);
if (addrp->base != 0 || addrp->index != 0) {
if (addrp->base != NULL || addrp->index != NULL) {
db_printf("(");
if (addrp->base)
db_printf("%s", addrp->base);
@ -1248,7 +1248,7 @@ db_disasm(db_addr_t loc, bool altfmt)
get_value_inc(inst, loc, 1, FALSE);
short_addr = FALSE;
size = LONG;
seg = 0;
seg = NULL;
/*
* Get prefixes
@ -1313,7 +1313,7 @@ db_disasm(db_addr_t loc, bool altfmt)
while (ip->i_size == ESC) {
get_value_inc(inst, loc, 1, FALSE);
ip = ((const struct inst * const *)ip->i_extra)[inst>>4];
if (ip == 0) {
if (ip == NULL) {
ip = &db_bad_inst;
}
else {

View File

@ -391,7 +391,7 @@ static struct md_page pv_dummy;
/*
* All those kernel PT submaps that BSD is so fond of
*/
pt_entry_t *CMAP1 = 0;
pt_entry_t *CMAP1 = NULL;
caddr_t CADDR1 = 0;
static vm_offset_t qframe = 0;
static struct mtx qframe_mtx;

View File

@ -103,7 +103,7 @@ md_strategy(void *devdata, int rw, daddr_t blk, size_t size,
if ((ofs + size) > MD_IMAGE_SIZE)
size = MD_IMAGE_SIZE - ofs;
if (rsize != 0)
if (rsize != NULL)
*rsize = size;
switch (rw) {

View File

@ -131,13 +131,13 @@ efinet_put(struct iodesc *desc, void *pkt, size_t len)
/* Wait for the buffer to be transmitted */
do {
buf = 0; /* XXX Is this needed? */
buf = NULL; /* XXX Is this needed? */
status = net->GetStatus(net, 0, &buf);
/*
* XXX EFI1.1 and the E1000 card returns a different
* address than we gave. Sigh.
*/
} while (status == EFI_SUCCESS && buf == 0);
} while (status == EFI_SUCCESS && buf == NULL);
/* XXX How do we deal with status != EFI_SUCCESS now? */
return ((status == EFI_SUCCESS) ? len : -1);

View File

@ -64,7 +64,7 @@ fdt_get_fixup_location(void *fdtp, const char *fixup)
int prop_offset, o, proplen;
void *result;
result = 0;
result = NULL;
path = strdup(fixup);
prop = strchr(path, ':');

View File

@ -276,7 +276,7 @@ void ficlFreeVM(FICL_VM *pVM)
FICL_SYSTEM *pSys = pVM->pSys;
FICL_VM *pList = pSys->vmList;
assert(pVM != 0);
assert(pVM != NULL);
if (pSys->vmList == pVM)
{

View File

@ -75,7 +75,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,
void *addr;
addr = malloc(dmat->maxsize + dmat->alignment, XXX, XXX);
if (addr == 0)
if (addr == NULL)
return (ENOMEM);
*mapp = addr;

View File

@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$");
#include "libofw.h"
#include "openfirm.h"
static void *heap_base = 0;
static void *heap_base = NULL;
static unsigned int heap_size = 0;
struct ofw_mapping {

View File

@ -859,7 +859,7 @@ main(int (*openfirm)(void *))
/*
* Initialize devices.
*/
for (dp = devsw; *dp != 0; dp++)
for (dp = devsw; *dp != NULL; dp++)
if ((*dp)->dv_init != 0)
(*dp)->dv_init();

View File

@ -91,8 +91,8 @@ userdisk_init(void)
return (ENOMEM);
for (i = 0; i < userdisk_maxunit; i++) {
if (CALLBACK(diskioctl, i, DIOCGSECTORSIZE,
&sectorsize) != 0 || CALLBACK(diskioctl, i,
DIOCGMEDIASIZE, &mediasize) != 0)
&sectorsize) != NULL || CALLBACK(diskioctl, i,
DIOCGMEDIASIZE, &mediasize) != NULL)
return (ENXIO);
ud_info[i].mediasize = mediasize;
ud_info[i].sectorsize = sectorsize;

View File

@ -126,7 +126,7 @@ zfs_close(struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
dnode_cache_obj = 0;
dnode_cache_obj = NULL;
f->f_fsdata = (void *)0;
if (fp == (struct file *)0)
return (0);

View File

@ -69,7 +69,7 @@ static const char *features_for_read[] = {
static spa_list_t zfs_pools;
static uint64_t zfs_crc64_table[256];
static const dnode_phys_t *dnode_cache_obj = 0;
static const dnode_phys_t *dnode_cache_obj = NULL;
static uint64_t dnode_cache_bn;
static char *dnode_cache_buf;
static char *zap_scratch;
@ -1527,7 +1527,7 @@ fzap_lookup(const spa_t *spa, const dnode_phys_t *dnode, const char *name,
zc = &ZAP_LEAF_CHUNK(&zl, h);
while (zc->l_entry.le_hash != hash) {
if (zc->l_entry.le_next == 0xffff) {
zc = 0;
zc = NULL;
break;
}
zc = &ZAP_LEAF_CHUNK(&zl, zc->l_entry.le_next);
@ -2316,7 +2316,7 @@ zfs_lookup(const struct zfsmount *mount, const char *upath, dnode_phys_t *dnode)
p = q;
} else {
strcpy(element, p);
p = 0;
p = NULL;
}
rc = zfs_dnode_stat(spa, &dn, &sb);

View File

@ -268,7 +268,7 @@ iconv_xlat16_conv(void *d2p, const char **inbuf,
* there is a case that inbuf char is a single
* byte char while inlen == 2
*/
if ((u_char)*(src+1) == 0 && !nullin ) {
if ((u_char)*(src+1) == '\0' && !nullin ) {
src++;
ir--;
} else {

View File

@ -329,7 +329,7 @@ apb_alloc_resource(device_t bus, device_t child, int type, int *rid,
}
rv = rman_reserve_resource(rm, start, end, count, flags, child);
if (rv == 0) {
if (rv == NULL) {
printf("%s: could not reserve resource %d\n", __func__, type);
return (0);
}

View File

@ -400,7 +400,7 @@ fddi_input(ifp, m)
m_adj(m, FDDI_HDR_LEN);
m = m_pullup(m, LLC_SNAPFRAMELEN);
if (m == 0) {
if (m == NULL) {
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
goto dropanyway;
}

View File

@ -487,7 +487,7 @@ iso88025_input(ifp, m)
m_adj(m, mac_hdr_len);
m = m_pullup(m, LLC_SNAPFRAMELEN);
if (m == 0) {
if (m == NULL) {
if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
goto dropanyway;
}

View File

@ -1003,7 +1003,7 @@ iflib_netmap_txq_init(if_ctx_t ctx, iflib_txq_t txq)
struct netmap_slot *slot;
slot = netmap_reset(na, NR_TX, txq->ift_id, 0);
if (slot == 0)
if (slot == NULL)
return;
for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxd[0]; i++) {
@ -1028,7 +1028,7 @@ iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq)
int nrxd;
slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0);
if (slot == 0)
if (slot == NULL)
return;
map = rxq->ifr_fl[0].ifl_sds.ifsd_map;
nrxd = ctx->ifc_softc_ctx.isc_nrxd[0];

View File

@ -3135,7 +3135,7 @@ int
classify_opcode_kidx(ipfw_insn *cmd, uint16_t *puidx)
{
if (find_op_rw(cmd, puidx, NULL) == 0)
if (find_op_rw(cmd, puidx, NULL) == NULL)
return (1);
return (0);
}