fsck_ffs for pointers replace 0 with NULL.

Found with devel/coccinelle.

Reviewed by:	mckusick
This commit is contained in:
Pedro F. Giffuni 2016-04-12 22:55:47 +00:00
parent 6ba5a1d9ee
commit 7d5e656214
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297886
9 changed files with 16 additions and 16 deletions

View File

@ -702,7 +702,7 @@ static struct bufarea *
getdirblk(ufs2_daddr_t blkno, long size) getdirblk(ufs2_daddr_t blkno, long size)
{ {
if (pdirbp != 0) if (pdirbp != NULL)
pdirbp->b_flags &= ~B_INUSE; pdirbp->b_flags &= ~B_INUSE;
pdirbp = getdatablk(blkno, size, BT_DIRDATA); pdirbp = getdatablk(blkno, size, BT_DIRDATA);
return (pdirbp); return (pdirbp);

View File

@ -184,7 +184,7 @@ bufinit(void)
pbp = pdirbp = (struct bufarea *)0; pbp = pdirbp = (struct bufarea *)0;
bufp = Malloc((unsigned int)sblock.fs_bsize); bufp = Malloc((unsigned int)sblock.fs_bsize);
if (bufp == 0) if (bufp == NULL)
errx(EEXIT, "cannot allocate buffer pool"); errx(EEXIT, "cannot allocate buffer pool");
cgblk.b_un.b_buf = bufp; cgblk.b_un.b_buf = bufp;
initbarea(&cgblk, BT_CYLGRP); initbarea(&cgblk, BT_CYLGRP);

View File

@ -290,7 +290,7 @@ ginode(ino_t inumber)
if (startinum == 0 || if (startinum == 0 ||
inumber < startinum || inumber >= startinum + INOPB(&sblock)) { inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
iblk = ino_to_fsba(&sblock, inumber); iblk = ino_to_fsba(&sblock, inumber);
if (pbp != 0) if (pbp != NULL)
pbp->b_flags &= ~B_INUSE; pbp->b_flags &= ~B_INUSE;
pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES); pbp = getdatablk(iblk, sblock.fs_bsize, BT_INODES);
startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock); startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
@ -608,7 +608,7 @@ pinode(ino_t ino)
return; return;
dp = ginode(ino); dp = ginode(ino);
printf(" OWNER="); 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); printf("%s ", pw->pw_name);
else else
printf("%u ", (unsigned)DIP(dp, di_uid)); printf("%u ", (unsigned)DIP(dp, di_uid));

View File

@ -349,10 +349,10 @@ checkfilesys(char *filesys)
pfatal( pfatal(
"CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n", "CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
snapname, strerror(errno)); snapname, strerror(errno));
} else if ((grp = getgrnam("operator")) == 0 || } else if ((grp = getgrnam("operator")) == NULL ||
mkdir(snapname, 0770) < 0 || mkdir(snapname, 0770) < 0 ||
chown(snapname, -1, grp->gr_gid) < 0 || chown(snapname, -1, grp->gr_gid) < 0 ||
chmod(snapname, 0770) < 0) { chmod(snapname, 0770) < 0) {
bkgrdflag = 0; bkgrdflag = 0;
pfatal( pfatal(
"CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n", "CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",

View File

@ -151,7 +151,7 @@ pass1(void)
*/ */
inostathead[c].il_numalloced = inosused; inostathead[c].il_numalloced = inosused;
if (inosused == 0) { if (inosused == 0) {
inostathead[c].il_stat = 0; inostathead[c].il_stat = NULL;
continue; continue;
} }
info = Calloc((unsigned)inosused, sizeof(struct inostat)); info = Calloc((unsigned)inosused, sizeof(struct inostat));
@ -221,7 +221,7 @@ pass1(void)
inostathead[c].il_numalloced = inosused; inostathead[c].il_numalloced = inosused;
if (inosused == 0) { if (inosused == 0) {
free(inostathead[c].il_stat); free(inostathead[c].il_stat);
inostathead[c].il_stat = 0; inostathead[c].il_stat = NULL;
continue; continue;
} }
info = Calloc((unsigned)inosused, sizeof(struct inostat)); info = Calloc((unsigned)inosused, sizeof(struct inostat));
@ -500,9 +500,9 @@ pass1check(struct inodesc *idesc)
return (STOP); return (STOP);
} }
new->dup = blkno; new->dup = blkno;
if (muldup == 0) { if (muldup == NULL) {
duplist = muldup = new; duplist = muldup = new;
new->next = 0; new->next = NULL;
} else { } else {
new->next = muldup->next; new->next = muldup->next;
muldup->next = new; muldup->next = new;

View File

@ -108,7 +108,7 @@ pass1bcheck(struct inodesc *idesc)
if (dlp == muldup) if (dlp == muldup)
break; break;
} }
if (muldup == 0 || duphead == muldup->next) { if (muldup == NULL || duphead == muldup->next) {
rerun = 1; rerun = 1;
return (STOP); return (STOP);
} }

View File

@ -143,7 +143,7 @@ pass4check(struct inodesc *idesc)
free((char *)dlp); free((char *)dlp);
break; break;
} }
if (dlp == 0) { if (dlp == NULL) {
clrbmap(blkno); clrbmap(blkno);
n_blks--; n_blks--;
} }

View File

@ -82,7 +82,7 @@ pass5(void)
} }
} }
if (fs->fs_maxcontig > 1) { if (fs->fs_maxcontig > 1) {
const char *doit = 0; const char *doit = NULL;
if (fs->fs_contigsumsize < 1) { if (fs->fs_contigsumsize < 1) {
doit = "CREAT"; doit = "CREAT";

View File

@ -68,7 +68,7 @@ blockcheck(char *origname)
newname = origname; newname = origname;
if (stat(newname, &stblock) < 0) { if (stat(newname, &stblock) < 0) {
cp = strrchr(newname, '/'); cp = strrchr(newname, '/');
if (cp == 0) { if (cp == NULL) {
(void)snprintf(device, sizeof(device), "%s%s", (void)snprintf(device, sizeof(device), "%s%s",
_PATH_DEV, newname); _PATH_DEV, newname);
newname = device; newname = device;