Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Apr 2016 17:04:07 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297974 - in head/sys: i386/i386 i386/ibcs2 x86/x86
Message-ID:  <201604141704.u3EH47Vv063976@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu Apr 14 17:04:06 2016
New Revision: 297974
URL: https://svnweb.freebsd.org/changeset/base/297974

Log:
  x86: for pointers replace 0 with NULL.
  
  These are mostly cosmetical, no functional change.
  
  Found with devel/coccinelle.

Modified:
  head/sys/i386/i386/db_disasm.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/ibcs2/imgact_coff.c
  head/sys/x86/x86/nexus.c

Modified: head/sys/i386/i386/db_disasm.c
==============================================================================
--- head/sys/i386/i386/db_disasm.c	Thu Apr 14 16:32:27 2016	(r297973)
+++ head/sys/i386/i386/db_disasm.c	Thu Apr 14 17:04:06 2016	(r297974)
@@ -953,17 +953,17 @@ db_read_address(loc, short_addr, regmodr
 	    return (loc);
 	}
 	addrp->is_reg = FALSE;
-	addrp->index = 0;
+	addrp->index = NULL;
 
 	if (short_addr) {
-	    addrp->index = 0;
+	    addrp->index = NULL;
 	    addrp->ss = 0;
 	    switch (mod) {
 		case 0:
 		    if (rm == 6) {
 			get_value_inc(disp, loc, 2, FALSE);
 			addrp->disp = disp;
-			addrp->base = 0;
+			addrp->base = NULL;
 		    }
 		    else {
 			addrp->disp = 0;
@@ -997,7 +997,7 @@ db_read_address(loc, short_addr, regmodr
 		case 0:
 		    if (rm == 5) {
 			get_value_inc(addrp->disp, loc, 4, FALSE);
-			addrp->base = 0;
+			addrp->base = NULL;
 		    }
 		    else {
 			addrp->disp = 0;
@@ -1037,7 +1037,7 @@ db_print_address(seg, size, addrp)
 	}
 
 	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);
@@ -1171,7 +1171,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
@@ -1239,7 +1239,7 @@ db_disasm(db_addr_t loc, bool altfmt)
 	if (inst == 0x0f) {
 	    get_value_inc(inst, loc, 1, FALSE);
 	    ip = db_inst_0f[inst>>4];
-	    if (ip == 0) {
+	    if (ip == NULL) {
 		ip = &db_bad_inst;
 	    }
 	    else {

Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c	Thu Apr 14 16:32:27 2016	(r297973)
+++ head/sys/i386/i386/pmap.c	Thu Apr 14 17:04:06 2016	(r297974)
@@ -269,15 +269,15 @@ pt_entry_t *CMAP3;
 static pd_entry_t *KPTD;
 caddr_t ptvmmap = 0;
 caddr_t CADDR3;
-struct msgbuf *msgbufp = 0;
+struct msgbuf *msgbufp = NULL;
 
 /*
  * Crashdump maps.
  */
 static caddr_t crashdumpmap;
 
-static pt_entry_t *PMAP1 = 0, *PMAP2;
-static pt_entry_t *PADDR1 = 0, *PADDR2;
+static pt_entry_t *PMAP1 = NULL, *PMAP2;
+static pt_entry_t *PADDR1 = NULL, *PADDR2;
 #ifdef SMP
 static int PMAP1cpu;
 static int PMAP1changedcpu;

Modified: head/sys/i386/ibcs2/imgact_coff.c
==============================================================================
--- head/sys/i386/ibcs2/imgact_coff.c	Thu Apr 14 16:32:27 2016	(r297973)
+++ head/sys/i386/ibcs2/imgact_coff.c	Thu Apr 14 17:04:06 2016	(r297974)
@@ -69,7 +69,7 @@ load_coff_section(struct vmspace *vmspac
 	vm_offset_t map_offset;
 	vm_offset_t map_addr;
 	int error;
-	unsigned char *data_buf = 0;
+	unsigned char *data_buf = NULL;
 	size_t copy_len;
 
 	map_offset = trunc_page(offset);
@@ -163,7 +163,7 @@ coff_load_file(struct thread *td, char *
   	struct filehdr *fhdr;
   	struct aouthdr *ahdr;
   	struct scnhdr *scns;
-  	char *ptr = 0;
+  	char *ptr = NULL;
   	int nscns;
   	unsigned long text_offset = 0, text_address = 0, text_size = 0;
   	unsigned long data_offset = 0, data_address = 0, data_size = 0;
@@ -363,7 +363,7 @@ exec_coff_imgact(imgp)
 	    	/* .bss section */
 	    	bss_size = scns[i].s_size;
 	  } else if (scns[i].s_flags & STYP_LIB) {
-	    	char *buf = 0;
+	    	char *buf = NULL;
 	    	int foff = trunc_page(scns[i].s_scnptr);
 	    	int off = scns[i].s_scnptr - foff;
 	    	int len = round_page(scns[i].s_size + PAGE_SIZE);

Modified: head/sys/x86/x86/nexus.c
==============================================================================
--- head/sys/x86/x86/nexus.c	Thu Apr 14 16:32:27 2016	(r297973)
+++ head/sys/x86/x86/nexus.c	Thu Apr 14 17:04:06 2016	(r297974)
@@ -397,7 +397,7 @@ nexus_alloc_resource(device_t bus, devic
 		return (NULL);
 
 	rv = rman_reserve_resource(rm, start, end, count, flags, child);
-	if (rv == 0)
+	if (rv == NULL)
 		return 0;
 	rman_set_rid(rv, *rid);
 
@@ -526,7 +526,7 @@ nexus_setup_intr(device_t bus, device_t 
 	if (irq == NULL)
 		panic("nexus_setup_intr: NULL irq resource!");
 
-	*cookiep = 0;
+	*cookiep = NULL;
 	if ((rman_get_flags(irq) & RF_SHAREABLE) == 0)
 		flags |= INTR_EXCL;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201604141704.u3EH47Vv063976>