netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harsha Sharma <harshasharmaiitr@gmail.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org,
	outreachy-kernel@googlegroups.com,
	Harsha Sharma <harshasharmaiitr@gmail.com>
Subject: [PATCH] src: Merge assignment with return
Date: Sat,  7 Oct 2017 04:00:33 +0530	[thread overview]
Message-ID: <20171006223033.664-1-harshasharmaiitr@gmail.com> (raw)

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@gmail.com>
---
 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


             reply	other threads:[~2017-10-06 22:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 22:30 Harsha Sharma [this message]
2017-10-09 13:21 ` [PATCH] src: Merge assignment with return Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171006223033.664-1-harshasharmaiitr@gmail.com \
    --to=harshasharmaiitr@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=outreachy-kernel@googlegroups.com \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).