Skip to contentSkip to conversation

staging: lustre: mgc: Bool tests do not need comparison

PATCH In review Bhaktipriya Shridhar 2 participants 3 messages Feb 27, 2016 – Mar 2, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: lustre: mgc: Bool tests do not need comparison

Bool initializations should use true and false thus bool tests don't need an explicit comparison.

This issue was found using the following Coccinelle script:
@@
bool x;
symbol true;
symbol false;
@@

(
- x == true
+ x
|
- true == x
+ x
|
- x != true
+ !x
|
- true != x
+ !x
|
- x == false
+ !x
|
- false == x
+ !x
|
- x != false
+ x
|
- false != x
+ x
)

---
Changes in v2:
-Fixed typo "lusture" to "lustre" in the subject

 drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +1 -1
index 6fc8225..aea5fc3 100644
@@ -1394,7 +1394,7 @@ again:
 	eof = res->mcr_offset == res->mcr_size;
 
 	CDEBUG(D_INFO, "Latest version %lld, more %d.\n",
-	       res->mcr_offset, eof == false);
+	       res->mcr_offset, !eof);
 
 	ealen = sptlrpc_cli_unwrap_bulk_read(req, req->rq_bulk, 0);
 	if (ealen < 0) {

--
2.1.4

maintainer
#1 lore raw
Quoted 49 lines · Bhaktipriya Shridhar

Bool initializations should use true and false thus bool tests don't need an explicit comparison.

This issue was found using the following Coccinelle script:
@@
bool x;
symbol true;
symbol false;
@@

(
- x == true
+ x
|
- true == x
+ x
|
- x != true
+ !x
|
- true != x
+ !x
|
- x == false
+ !x
|
- false == x
+ !x
|
- x != false
+ x
|
- false != x
+ x
)

---
Changes in v2:
-Fixed typo "lusture" to "lustre" in the subject

 drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +0 -0
index 6fc8225..aea5fc3 100644

drivers/staging/lustre/lustre/mgc/mgc_request.c again: · line 1397

Quoted 5 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1 -1
@@ -1394,7 +1394,7 @@ again:
 	eof = res->mcr_offset == res->mcr_size;
 
 	CDEBUG(D_INFO, "Latest version %lld, more %d.\n",
-	       res->mcr_offset, eof == false);
+	       res->mcr_offset, !eof);

eek, that's horrid to try to read, can you understand that now?

Please don't do that.

greg k-h

maintainer
#2 lore raw
In reply to Bhaktipriya Shridhar
Quoted 49 lines · Bhaktipriya Shridhar

Bool initializations should use true and false thus bool tests don't need an explicit comparison.

This issue was found using the following Coccinelle script:
@@
bool x;
symbol true;
symbol false;
@@

(
- x == true
+ x
|
- true == x
+ x
|
- x != true
+ !x
|
- true != x
+ !x
|
- x == false
+ !x
|
- false == x
+ !x
|
- x != false
+ x
|
- false != x
+ x
)

---
Changes in v2:
-Fixed typo "lusture" to "lustre" in the subject

 drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lustre/mgc/mgc_request.c +0 -0
index 6fc8225..aea5fc3 100644

drivers/staging/lustre/lustre/mgc/mgc_request.c again: · line 1397

Quoted 5 lines
drivers/staging/lustre/lustre/mgc/mgc_request.c +1 -1
@@ -1394,7 +1394,7 @@ again:
 	eof = res->mcr_offset == res->mcr_size;
 
 	CDEBUG(D_INFO, "Latest version %lld, more %d.\n",
-	       res->mcr_offset, eof == false);
+	       res->mcr_offset, !eof);

eek, that's horrid to try to read, can you understand that now?

Please don't do that.

greg k-h