Skip to contentSkip to conversation

- [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd

PATCH In review Joe Perches 2 participants 2 messages Nov 14, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 - [9/15] - remove defconfig ptr comparisons to 0 - fs/nfsd

Remove defconfig ptr comparison to 0

Remove sparse warning: Using plain integer as NULL pointer

---

fs/nfsd/vfs.c +1 -1
index d019918..07b38cf 100644
@@ -987,7 +987,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	 * flushing the data to disk is handled separately below.
 	 */
 
-	if (file->f_op->fsync == 0) {/* COMMIT3 cannot work */
+	if (!file->f_op->fsync) {/* COMMIT3 cannot work */
 	       stable = 2;
 	       *stablep = 2; /* FILE_SYNC */
 	}

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw
Quoted 14 lines · On Tuesday November 13, [email protected] wrote:

Remove defconfig ptr comparison to 0

Remove sparse warning: Using plain integer as NULL pointer

---

fs/nfsd/vfs.c +0 -0
index d019918..07b38cf 100644

fs/nfsd/vfs.c nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, · line 993

Quoted 8 lines
fs/nfsd/vfs.c +1 -1
@@ -987,7 +987,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
 	 * flushing the data to disk is handled separately below.
 	 */
 
-	if (file->f_op->fsync == 0) {/* COMMIT3 cannot work */
+	if (!file->f_op->fsync) {/* COMMIT3 cannot work */
 	       stable = 2;
 	       *stablep = 2; /* FILE_SYNC */
 	}

Personally, I would much rather these were changed to "== NULL". Different people have different preferences on whether to use
! foo
or

    foo == NULL

and the person who wrote that code is presumably showing a preference for the later. Changing it from "== 0" to "== NULL" is clearly a valuable improvement. Changing from "== 0" to "! " is a stylistic change that should not be made lightly.

I personally often use and prefer the explicit comparison to NULL.

NeilBrown

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs