[PATCH] src: Merge assignment with return

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Merge assignment with return statement to directly return the value.
Done using following coccinelle semantic patch

@@
local idexpression ret;
expression e;
@@

-ret =
+return
     e;
-return ret;

Signed-off-by: Harsha Sharma <harshasharmaiitr@xxxxxxxxx>
---
 src/mini-gmp.c  | 3 +--
 src/statement.c | 5 +----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/mini-gmp.c b/src/mini-gmp.c
index acbe1be..0579c46 100644
--- a/src/mini-gmp.c
+++ b/src/mini-gmp.c
@@ -1297,8 +1297,7 @@ mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn,
 	    }
 	}
     }
-  rn = mpn_normalized_size (rp, rn);
-  return rn;
+  return mpn_normalized_size(rp, rn);
 }

 static mp_size_t
diff --git a/src/statement.c b/src/statement.c
index 6166863..168f944 100644
--- a/src/statement.c
+++ b/src/statement.c
@@ -208,10 +208,7 @@ static const struct stmt_ops objref_stmt_ops = {

 struct stmt *objref_stmt_alloc(const struct location *loc)
 {
-	struct stmt *stmt;
-
-	stmt = stmt_alloc(loc, &objref_stmt_ops);
-	return stmt;
+	return stmt_alloc(loc, &objref_stmt_ops);
 }

 static const char *syslog_level[LOG_DEBUG + 1] = {
--
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux