From 3e522256cfc1177fdbb959a017a304d0681aef38 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 8 Jul 2010 12:09:29 +0200 Subject: [PATCH] get_variable_from_expr_complex(): return proper symbol for array expressions For the "foo[bar]" expression, we used to return the symbol for "bar" but really it would be better to return the symbol for foo. Signed-off-by: Dan Carpenter --- smatch_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/smatch_helper.c b/smatch_helper.c index a36f4d04..30583b26 100644 --- a/smatch_helper.c +++ b/smatch_helper.c @@ -162,16 +162,16 @@ static void __get_variable_from_expr(struct symbol **sym_ptr, char *buf, *complicated = 1; array_expr = get_array_expr(expr); if (array_expr) { - __get_variable_from_expr(NULL, buf, array_expr, len, complicated); + __get_variable_from_expr(sym_ptr, buf, array_expr, len, complicated); append(buf, "[", len); } else { append(buf, "(", len); - __get_variable_from_expr(NULL, buf, expr->left, len, + __get_variable_from_expr(sym_ptr, buf, expr->left, len, complicated); tmp = show_special(expr->op); append(buf, tmp, len); } - __get_variable_from_expr(sym_ptr, buf, expr->right, + __get_variable_from_expr(NULL, buf, expr->right, len, complicated); if (array_expr) append(buf, "]", len); -- 2.11.4.GIT