* [PATCH] src: Merge assignment with return
@ 2017-10-06 22:30 Harsha Sharma
2017-10-09 13:21 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Harsha Sharma @ 2017-10-06 22:30 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, outreachy-kernel, Harsha Sharma
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] src: Merge assignment with return
2017-10-06 22:30 [PATCH] src: Merge assignment with return Harsha Sharma
@ 2017-10-09 13:21 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-09 13:21 UTC (permalink / raw)
To: Harsha Sharma; +Cc: netfilter-devel, outreachy-kernel
Hi Harsha,
On Sat, Oct 07, 2017 at 04:00:33AM +0530, Harsha Sharma wrote:
> 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);
mini-gmp.c has been extracted from libgmp sources [1], so either you
submit this chunk to them, or you leave this part as is. I would like
we just cache a copy of the mini-gmp.c original file.
Probably you can just check if latest stable release of libgmp
contains updates for mini-gmp.{c,h} and send us a patch to get in sync
with them.
Thanks.
[1] https://gmplib.org/repo/gmp/file/tip/mini-gmp
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-09 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-06 22:30 [PATCH] src: Merge assignment with return Harsha Sharma
2017-10-09 13:21 ` Pablo Neira Ayuso
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).