From d41dbd01c7025fa608642ea60eb0d7bedeeea05c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 20 Jan 2017 15:25:33 +0300 Subject: [PATCH] helper: In expr_to_str() remove extra parenthesis around variables Just remove the parenthesis if you have an expression like "(var)" they have no meaning because we can't possibly split a variable. Signed-off-by: Dan Carpenter --- smatch_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smatch_helper.c b/smatch_helper.c index a02d6ed3..acc7c34d 100644 --- a/smatch_helper.c +++ b/smatch_helper.c @@ -191,7 +191,7 @@ static void __get_variable_from_expr(struct symbol **sym_ptr, char *buf, } if (expr->op == '(') { - if (!no_parens) + if (!no_parens && expr->unop->type != EXPR_SYMBOL) append(buf, "(", len); } else if (expr->op != '*' || !get_array_expr(expr->unop)) { tmp = show_special(expr->op); @@ -200,7 +200,7 @@ static void __get_variable_from_expr(struct symbol **sym_ptr, char *buf, __get_variable_from_expr(sym_ptr, buf, expr->unop, len, complicated, no_parens); - if (expr->op == '(' && !no_parens) + if (expr->op == '(' && !no_parens && expr->unop->type != EXPR_SYMBOL) append(buf, ")", len); if (expr->op == SPECIAL_DECREMENT || -- 2.11.4.GIT