diff --git a/sys/amd64/amd64/db_disasm.c b/sys/amd64/amd64/db_disasm.c index dd436d7d6bb4..0ec81f47fd44 100644 --- a/sys/amd64/amd64/db_disasm.c +++ b/sys/amd64/amd64/db_disasm.c @@ -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 { diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 0351c551dfbb..6d984ab885e2 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -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; diff --git a/sys/boot/common/md.c b/sys/boot/common/md.c index e81d1bb6e28e..22a0e953ad54 100644 --- a/sys/boot/common/md.c +++ b/sys/boot/common/md.c @@ -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) { diff --git a/sys/boot/efi/libefi/efinet.c b/sys/boot/efi/libefi/efinet.c index 26802c2287d9..c598548ed9fc 100644 --- a/sys/boot/efi/libefi/efinet.c +++ b/sys/boot/efi/libefi/efinet.c @@ -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); diff --git a/sys/boot/fdt/fdt_overlay.c b/sys/boot/fdt/fdt_overlay.c index a19f06e8e947..0d9b367d4639 100644 --- a/sys/boot/fdt/fdt_overlay.c +++ b/sys/boot/fdt/fdt_overlay.c @@ -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, ':'); diff --git a/sys/boot/ficl/ficl.c b/sys/boot/ficl/ficl.c index d4370eb1a48a..219cf84b2225 100644 --- a/sys/boot/ficl/ficl.c +++ b/sys/boot/ficl/ficl.c @@ -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) { diff --git a/sys/boot/kshim/bsd_kernel.c b/sys/boot/kshim/bsd_kernel.c index c94b755e9eaf..75eccb1d6725 100644 --- a/sys/boot/kshim/bsd_kernel.c +++ b/sys/boot/kshim/bsd_kernel.c @@ -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; diff --git a/sys/boot/ofw/libofw/ofw_memory.c b/sys/boot/ofw/libofw/ofw_memory.c index 60cc90457bcb..5616184e8080 100644 --- a/sys/boot/ofw/libofw/ofw_memory.c +++ b/sys/boot/ofw/libofw/ofw_memory.c @@ -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 { diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index d7b4e1e7abbb..e70d9bbb0390 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -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(); diff --git a/sys/boot/userboot/userboot/userboot_disk.c b/sys/boot/userboot/userboot/userboot_disk.c index 045854f12b62..e49393e9f082 100644 --- a/sys/boot/userboot/userboot/userboot_disk.c +++ b/sys/boot/userboot/userboot/userboot_disk.c @@ -91,8 +91,8 @@ userdisk_init(void) return (ENOMEM); for (i = 0; i < userdisk_maxunit; i++) { if (CALLBACK(diskioctl, i, DIOCGSECTORSIZE, - §orsize) != 0 || CALLBACK(diskioctl, i, - DIOCGMEDIASIZE, &mediasize) != 0) + §orsize) != NULL || CALLBACK(diskioctl, i, + DIOCGMEDIASIZE, &mediasize) != NULL) return (ENXIO); ud_info[i].mediasize = mediasize; ud_info[i].sectorsize = sectorsize; diff --git a/sys/boot/zfs/zfs.c b/sys/boot/zfs/zfs.c index 6cad2935616d..062895eef79a 100644 --- a/sys/boot/zfs/zfs.c +++ b/sys/boot/zfs/zfs.c @@ -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); diff --git a/sys/boot/zfs/zfsimpl.c b/sys/boot/zfs/zfsimpl.c index 8729a7517d1c..7f9063026959 100644 --- a/sys/boot/zfs/zfsimpl.c +++ b/sys/boot/zfs/zfsimpl.c @@ -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); diff --git a/sys/libkern/iconv_xlat16.c b/sys/libkern/iconv_xlat16.c index 630cbd3aff76..c423413b0b68 100644 --- a/sys/libkern/iconv_xlat16.c +++ b/sys/libkern/iconv_xlat16.c @@ -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 { diff --git a/sys/mips/atheros/ar531x/apb.c b/sys/mips/atheros/ar531x/apb.c index a20ccc308705..cbf6776c6408 100644 --- a/sys/mips/atheros/ar531x/apb.c +++ b/sys/mips/atheros/ar531x/apb.c @@ -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); } diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 682a37caaea7..67a72c1f293e 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -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; } diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c index e5d5166d60c4..32aac4cd4dd5 100644 --- a/sys/net/if_iso88025subr.c +++ b/sys/net/if_iso88025subr.c @@ -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; } diff --git a/sys/net/iflib.c b/sys/net/iflib.c index e131dc46b1aa..34832c744e45 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -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]; diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c index 0823316e0884..4a8ffaacbcff 100644 --- a/sys/netpfil/ipfw/ip_fw_sockopt.c +++ b/sys/netpfil/ipfw/ip_fw_sockopt.c @@ -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); }