summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-12 22:55:47 +0000
committerpfg <pfg@FreeBSD.org>2016-04-12 22:55:47 +0000
commit64332fef7de27c50f6522add770ceda556bdb4d6 (patch)
tree61d0fd2754e2e62ac62c940e80fcb04675619407
parent5e2c24a43d150300de7952faf86b881bec60720a (diff)
downloadFreeBSD-src-64332fef7de27c50f6522add770ceda556bdb4d6.zip
FreeBSD-src-64332fef7de27c50f6522add770ceda556bdb4d6.tar.gz
fsck_ffs for pointers replace 0 with NULL.
Found with devel/coccinelle. Reviewed by: mckusick
-rw-r--r--sbin/fsck_ffs/dir.c2
-rw-r--r--sbin/fsck_ffs/fsutil.c2
-rw-r--r--sbin/fsck_ffs/inode.c4
-rw-r--r--sbin/fsck_ffs/main.c8
-rw-r--r--sbin/fsck_ffs/pass1.c8
-rw-r--r--sbin/fsck_ffs/pass1b.c2
-rw-r--r--sbin/fsck_ffs/pass4.c2
-rw-r--r--sbin/fsck_ffs/pass5.c2
-rw-r--r--sbin/fsck_ffs/utilities.c2
9 files changed, 16 insertions, 16 deletions
diff --git a/sbin/fsck_ffs/dir.c b/sbin/fsck_ffs/dir.c
index 9203000..6043497 100644
--- a/sbin/fsck_ffs/dir.c
+++ b/sbin/fsck_ffs/dir.c
@@ -702,7 +702,7 @@ static struct bufarea *
getdirblk(ufs2_daddr_t blkno, long size)
{
- if (pdirbp != 0)
+ if (pdirbp != NULL)
pdirbp->b_flags &= ~B_INUSE;
pdirbp = getdatablk(blkno, size, BT_DIRDATA);
return (pdirbp);
diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c
index bc80e2f..713c9d4 100644
--- a/sbin/fsck_ffs/fsutil.c
+++ b/sbin/fsck_ffs/fsutil.c
@@ -184,7 +184,7 @@ bufinit(void)
pbp = pdirbp = (struct bufarea *)0;
bufp = Malloc((unsigned int)sblock.fs_bsize);
- if (bufp == 0)
+ if (bufp == NULL)
errx(EEXIT, "cannot allocate buffer pool");
cgblk.b_un.b_buf = bufp;
initbarea(&cgblk, BT_CYLGRP);
diff --git a/sbin/fsck_ffs/inode.c b/sbin/fsck_ffs/inode.c
index e8baf09..e938178 100644
--- a/sbin/fsck_ffs/inode.c
+++ b/sbin/fsck_ffs/inode.c
@@ -290,7 +290,7 @@ ginode(ino_t inumber)
if (startinum == 0 ||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
iblk = ino_to_fsba(&sblock, inumber);
- if (pbp != 0)
+ if (pbp != NULL)
pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
@@ -608,7 +608,7 @@ pinode(ino_t ino)
return;
dp = ginode(ino);
printf(" OWNER=");
- if ((pw = getpwuid((int)DIP(dp, di_uid))) != 0)
+ if ((pw = getpwuid((int)DIP(dp, di_uid))) != NULL)
printf("%s ", pw->pw_name);
else
printf("%u ", (unsigned)DIP(dp, di_uid));
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 08c7745..f2fb588 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -349,10 +349,10 @@ checkfilesys(char *filesys)
pfatal(
"CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
snapname, strerror(errno));
- } else if ((grp = getgrnam("operator")) == 0 ||
- mkdir(snapname, 0770) < 0 ||
- chown(snapname, -1, grp->gr_gid) < 0 ||
- chmod(snapname, 0770) < 0) {
+ } else if ((grp = getgrnam("operator")) == NULL ||
+ mkdir(snapname, 0770) < 0 ||
+ chown(snapname, -1, grp->gr_gid) < 0 ||
+ chmod(snapname, 0770) < 0) {
bkgrdflag = 0;
pfatal(
"CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
diff --git a/sbin/fsck_ffs/pass1.c b/sbin/fsck_ffs/pass1.c
index 67fba6e..98d2a05 100644
--- a/sbin/fsck_ffs/pass1.c
+++ b/sbin/fsck_ffs/pass1.c
@@ -151,7 +151,7 @@ pass1(void)
*/
inostathead[c].il_numalloced = inosused;
if (inosused == 0) {
- inostathead[c].il_stat = 0;
+ inostathead[c].il_stat = NULL;
continue;
}
info = Calloc((unsigned)inosused, sizeof(struct inostat));
@@ -221,7 +221,7 @@ pass1(void)
inostathead[c].il_numalloced = inosused;
if (inosused == 0) {
free(inostathead[c].il_stat);
- inostathead[c].il_stat = 0;
+ inostathead[c].il_stat = NULL;
continue;
}
info = Calloc((unsigned)inosused, sizeof(struct inostat));
@@ -500,9 +500,9 @@ pass1check(struct inodesc *idesc)
return (STOP);
}
new->dup = blkno;
- if (muldup == 0) {
+ if (muldup == NULL) {
duplist = muldup = new;
- new->next = 0;
+ new->next = NULL;
} else {
new->next = muldup->next;
muldup->next = new;
diff --git a/sbin/fsck_ffs/pass1b.c b/sbin/fsck_ffs/pass1b.c
index 69a23c2..52f7479 100644
--- a/sbin/fsck_ffs/pass1b.c
+++ b/sbin/fsck_ffs/pass1b.c
@@ -108,7 +108,7 @@ pass1bcheck(struct inodesc *idesc)
if (dlp == muldup)
break;
}
- if (muldup == 0 || duphead == muldup->next) {
+ if (muldup == NULL || duphead == muldup->next) {
rerun = 1;
return (STOP);
}
diff --git a/sbin/fsck_ffs/pass4.c b/sbin/fsck_ffs/pass4.c
index 80a32c1..3b64dfb 100644
--- a/sbin/fsck_ffs/pass4.c
+++ b/sbin/fsck_ffs/pass4.c
@@ -143,7 +143,7 @@ pass4check(struct inodesc *idesc)
free((char *)dlp);
break;
}
- if (dlp == 0) {
+ if (dlp == NULL) {
clrbmap(blkno);
n_blks--;
}
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c
index 13ef86d..67ad68a 100644
--- a/sbin/fsck_ffs/pass5.c
+++ b/sbin/fsck_ffs/pass5.c
@@ -82,7 +82,7 @@ pass5(void)
}
}
if (fs->fs_maxcontig > 1) {
- const char *doit = 0;
+ const char *doit = NULL;
if (fs->fs_contigsumsize < 1) {
doit = "CREAT";
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c
index 4e82c31..1a78cfd 100644
--- a/sbin/fsck_ffs/utilities.c
+++ b/sbin/fsck_ffs/utilities.c
@@ -68,7 +68,7 @@ blockcheck(char *origname)
newname = origname;
if (stat(newname, &stblock) < 0) {
cp = strrchr(newname, '/');
- if (cp == 0) {
+ if (cp == NULL) {
(void)snprintf(device, sizeof(device), "%s%s",
_PATH_DEV, newname);
newname = device;
OpenPOWER on IntegriCloud