After sending my previous reply I noticed that you already committed
your diff, so here are my comments again in the form of a proper diff:
* Use NULL instead of casting 0 to pointer types
* Remove unnecessary (char *) cast on buf because buf was already
declared as char *
* Simplify "if ((rc = ...) != 0)" idiom to equivalent "if ((rc = ...))"
Index: sys/lib/libsa/ufs2.c
===================================================================
RCS file: /work/cvsroot/src/sys/lib/libsa/ufs2.c,v
retrieving revision 1.2
diff -p -u -r1.2 ufs2.c
--- sys/lib/libsa/ufs2.c 29 Apr 2014 07:52:06 -0000 1.2
+++ sys/lib/libsa/ufs2.c 1 May 2014 16:54:25 -0000
@@ -217,7 +217,7 @@ block_map(struct open_file *f, daddr_t f
}
if (fp->f_blkno[level] != ind_block_num) {
- if (fp->f_blk[level] == (char *)0)
+ if (fp->f_blk[level] == NULL)
fp->f_blk[level] =
alloc(fs->fs_bsize);
twiddle();
@@ -269,7 +269,7 @@ buf_read_file(struct open_file *f, char
if (rc)
return (rc);
- if (fp->f_buf == (char *)0)
+ if (fp->f_buf == NULL)
fp->f_buf = alloc(fs->fs_bsize);
if (disk_block == 0) {
@@ -401,7 +401,7 @@ ufs2_open(char *path, struct open_file *
}
inumber = ROOTINO;
- if ((rc = read_inode(inumber, f)) != 0)
+ if ((rc = read_inode(inumber, f)))
goto out;
cp = path;
@@ -454,7 +454,7 @@ ufs2_open(char *path, struct open_file *
/*
* Open next component.
*/
- if ((rc = read_inode(inumber, f)) != 0)
+ if ((rc = read_inode(inumber, f)))
goto out;
/*
@@ -498,7 +498,7 @@ ufs2_open(char *path, struct open_file *
if (rc)
goto out;
- bcopy((char *)buf, namebuf, (unsigned)link_len);
+ bcopy(buf, namebuf, (unsigned)link_len);
}
/*
@@ -511,7 +511,7 @@ ufs2_open(char *path, struct open_file *
else
inumber = ROOTINO;
- if ((rc = read_inode(inumber, f)) != 0)
+ if ((rc = read_inode(inumber, f)))
goto out;
}
}
@@ -534,8 +534,8 @@ ufs2_close(struct open_file *f)
{
struct file *fp = (struct file *)f->f_fsdata;
- f->f_fsdata = (void *)0;
- if (fp == (struct file *)0)
+ f->f_fsdata = NULL;
+ if (fp == NULL)
return (0);
return (ufs2_close_internal(fp));
@@ -656,7 +656,7 @@ ufs2_readdir(struct open_file *f, char *
}
do {
- if ((rc = buf_read_file(f, &buf, &buf_size)) != 0)
+ if ((rc = buf_read_file(f, &buf, &buf_size)))
return rc;
dp = (struct direct *)buf;