type: cleanp get_member_symbol()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Nov 2012 06:34:10 +0000 (23 09:34 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 23 Nov 2012 06:34:10 +0000 (23 09:34 +0300)
I want to use a temporary pointer here.  I noticed this in reading the
code.  I don't know that it causes a problem to mess with the iterator
pointer, but it looks wrong to me.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_type.c

index 4a132e0..6f7db2f 100644 (file)
@@ -82,14 +82,14 @@ static struct symbol *get_type_symbol(struct expression *expr)
 
 static struct symbol *get_member_symbol(struct symbol_list *symbol_list, struct ident *member)
 {
-       struct symbol *tmp;
+       struct symbol *tmp, *sub;
 
        FOR_EACH_PTR(symbol_list, tmp) {
                if (!tmp->ident) {
-                       tmp = get_real_base_type(tmp);
-                       tmp = get_member_symbol(tmp->symbol_list, member);
-                       if (tmp)
-                               return tmp;
+                       sub = get_real_base_type(tmp);
+                       sub = get_member_symbol(sub->symbol_list, member);
+                       if (sub)
+                               return sub;
                        continue;
                }
                if (tmp->ident == member)