svn commit: r297886 - head/sbin/fsck_ffs
Pedro F. Giffuni
pfg at FreeBSD.org
Tue Apr 12 22:55:49 UTC 2016
Author: pfg
Date: Tue Apr 12 22:55:47 2016
New Revision: 297886
URL: https://svnweb.freebsd.org/changeset/base/297886
Log:
fsck_ffs for pointers replace 0 with NULL.
Found with devel/coccinelle.
Reviewed by: mckusick
Modified:
head/sbin/fsck_ffs/dir.c
head/sbin/fsck_ffs/fsutil.c
head/sbin/fsck_ffs/inode.c
head/sbin/fsck_ffs/main.c
head/sbin/fsck_ffs/pass1.c
head/sbin/fsck_ffs/pass1b.c
head/sbin/fsck_ffs/pass4.c
head/sbin/fsck_ffs/pass5.c
head/sbin/fsck_ffs/utilities.c
Modified: head/sbin/fsck_ffs/dir.c
==============================================================================
--- head/sbin/fsck_ffs/dir.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/dir.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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);
Modified: head/sbin/fsck_ffs/fsutil.c
==============================================================================
--- head/sbin/fsck_ffs/fsutil.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/fsutil.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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);
Modified: head/sbin/fsck_ffs/inode.c
==============================================================================
--- head/sbin/fsck_ffs/inode.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/inode.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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));
Modified: head/sbin/fsck_ffs/main.c
==============================================================================
--- head/sbin/fsck_ffs/main.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/main.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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",
Modified: head/sbin/fsck_ffs/pass1.c
==============================================================================
--- head/sbin/fsck_ffs/pass1.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/pass1.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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;
Modified: head/sbin/fsck_ffs/pass1b.c
==============================================================================
--- head/sbin/fsck_ffs/pass1b.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/pass1b.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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);
}
Modified: head/sbin/fsck_ffs/pass4.c
==============================================================================
--- head/sbin/fsck_ffs/pass4.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/pass4.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -143,7 +143,7 @@ pass4check(struct inodesc *idesc)
free((char *)dlp);
break;
}
- if (dlp == 0) {
+ if (dlp == NULL) {
clrbmap(blkno);
n_blks--;
}
Modified: head/sbin/fsck_ffs/pass5.c
==============================================================================
--- head/sbin/fsck_ffs/pass5.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/pass5.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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";
Modified: head/sbin/fsck_ffs/utilities.c
==============================================================================
--- head/sbin/fsck_ffs/utilities.c Tue Apr 12 22:54:19 2016 (r297885)
+++ head/sbin/fsck_ffs/utilities.c Tue Apr 12 22:55:47 2016 (r297886)
@@ -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;
More information about the svn-src-head
mailing list