Skip to contentSkip to conversation

staging: lustre: lnet: selftest: Change the type of variable to bool

PATCH In review simran singhal 2 participants 2 messages Jun 20, 2017 – Jun 23, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: lnet: selftest: Change the type of variable to bool

This patch changes the type of variable done from int to boolean. As it is been used as a boolean in the function sfw_test_rpc_done(). It also makes the code more readable and bool data type also requires less memory in comparison to int data type.

---
 drivers/staging/lustre/lnet/selftest/framework.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lnet/selftest/framework.c +2 -2
index ef27bff..3789df6 100644
@@ -869,7 +869,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 {
 	struct sfw_test_unit *tsu = rpc->crpc_priv;
 	struct sfw_test_instance *tsi = tsu->tsu_instance;
-	int done = 0;
+	bool done = false;
 
 	tsi->tsi_ops->tso_done_rpc(tsu, rpc);
 
@@ -883,7 +883,7 @@ sfw_test_rpc_done(struct srpc_client_rpc *rpc)
 	/* batch is stopping or loop is done or get error */
 	if (tsi->tsi_stopping || !tsu->tsu_loop ||
 	    (rpc->crpc_status && tsi->tsi_stoptsu_onerr))
-		done = 1;
+		done = true;
 
 	/* dec ref for poster */
 	srpc_client_rpc_decref(rpc);
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · simran singhal

This patch changes the type of variable done from int to boolean. As it is been used as a boolean in the function sfw_test_rpc_done(). It also makes the code more readable and bool data type also requires less memory in comparison to int data type.

Are you sure it takes less memory? What is the difference before and after your patch? Don't make claims without having a way to back them up :)

thanks,

greg k-h