diff mbox series

[4/6] inline: avoid needless intermediate vars

Message ID 20220626130748.74163-5-lucvoo@kernel.org (mailing list archive)
State Mainlined, archived
Headers show
Series cleanup related to inlining of variadic functions | expand

Commit Message

Luc Van Oostenryck June 26, 2022, 1:07 p.m. UTC
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

In inline_function(), the we need to iterate over the parameters
and the (effective) arguments. An itermediate variable is used for
each: "name_list" and "arg_list".

These confuse me a lot (especially "name_list", "param_list" would
be much more OK) and are just used once.

So, avoid using an intermediate variable for these.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 inline.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Ramsay Jones June 26, 2022, 2:45 p.m. UTC | #1
On 26/06/2022 14:07, Luc Van Oostenryck wrote:
> From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> 
> In inline_function(), the we need to iterate over the parameters

s/the we/we/


ATB,
Ramsay Jones

> and the (effective) arguments. An itermediate variable is used for
> each: "name_list" and "arg_list".
> 
> These confuse me a lot (especially "name_list", "param_list" would
> be much more OK) and are just used once.
> 
> So, avoid using an intermediate variable for these.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  inline.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/inline.c b/inline.c
> index 4696eb509f9a..a6f9252ab0ff 100644
> --- a/inline.c
> +++ b/inline.c
> @@ -516,9 +516,8 @@ int inline_function(struct expression *expr, struct symbol *sym)
>  {
>  	struct symbol_list * fn_symbol_list;
>  	struct symbol *fn = sym->ctype.base_type;
> -	struct expression_list *arg_list = expr->args;
>  	struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND);
> -	struct symbol_list *name_list, *arg_decl;
> +	struct symbol_list *arg_decl;
>  	struct symbol *name;
>  	struct expression *arg;
>  
> @@ -529,8 +528,6 @@ int inline_function(struct expression *expr, struct symbol *sym)
>  	if (fn->expanding)
>  		return 0;
>  
> -	name_list = fn->arguments;
> -
>  	expr->type = EXPR_STATEMENT;
>  	expr->statement = stmt;
>  	expr->ctype = fn->ctype.base_type;
> @@ -538,8 +535,8 @@ int inline_function(struct expression *expr, struct symbol *sym)
>  	fn_symbol_list = create_symbol_list(sym->inline_symbol_list);
>  
>  	arg_decl = NULL;
> -	PREPARE_PTR_LIST(name_list, name);
> -	FOR_EACH_PTR(arg_list, arg) {
> +	PREPARE_PTR_LIST(fn->arguments, name);
> +	FOR_EACH_PTR(expr->args, arg) {
>  		struct symbol *a = alloc_symbol(arg->pos, SYM_NODE);
>  
>  		if (name) {
diff mbox series

Patch

diff --git a/inline.c b/inline.c
index 4696eb509f9a..a6f9252ab0ff 100644
--- a/inline.c
+++ b/inline.c
@@ -516,9 +516,8 @@  int inline_function(struct expression *expr, struct symbol *sym)
 {
 	struct symbol_list * fn_symbol_list;
 	struct symbol *fn = sym->ctype.base_type;
-	struct expression_list *arg_list = expr->args;
 	struct statement *stmt = alloc_statement(expr->pos, STMT_COMPOUND);
-	struct symbol_list *name_list, *arg_decl;
+	struct symbol_list *arg_decl;
 	struct symbol *name;
 	struct expression *arg;
 
@@ -529,8 +528,6 @@  int inline_function(struct expression *expr, struct symbol *sym)
 	if (fn->expanding)
 		return 0;
 
-	name_list = fn->arguments;
-
 	expr->type = EXPR_STATEMENT;
 	expr->statement = stmt;
 	expr->ctype = fn->ctype.base_type;
@@ -538,8 +535,8 @@  int inline_function(struct expression *expr, struct symbol *sym)
 	fn_symbol_list = create_symbol_list(sym->inline_symbol_list);
 
 	arg_decl = NULL;
-	PREPARE_PTR_LIST(name_list, name);
-	FOR_EACH_PTR(arg_list, arg) {
+	PREPARE_PTR_LIST(fn->arguments, name);
+	FOR_EACH_PTR(expr->args, arg) {
 		struct symbol *a = alloc_symbol(arg->pos, SYM_NODE);
 
 		if (name) {