aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2009-03-11 07:08:35 +0000
committerChristopher Li <sparse@chrisli.org>2009-07-18 05:30:09 +0000
commitb608ddfe1816826b5061a5513c0df3c2de2db905 (patch)
treedd8d2507794ab5510003f65ab9009ec33ed77fd6
parentDon't mix storage class bits with ctype->modifiers while parsing type (diff)
downloadsparse-b608ddfe1816826b5061a5513c0df3c2de2db905.tar.gz
sparse-b608ddfe1816826b5061a5513c0df3c2de2db905.tar.bz2
sparse-b608ddfe1816826b5061a5513c0df3c2de2db905.zip
Sanitize pointer()
There's no need to concat the context list into (empty) one of new node, only to free the original one. Moving the pointer to list instead works fine... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Christopher Li <chrisl@hera.kernel.org>
-rw-r--r--parse.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/parse.c b/parse.c
index a70b1a4..e2b47e3 100644
--- a/parse.c
+++ b/parse.c
@@ -1592,28 +1592,18 @@ static struct token *direct_declarator(struct token *token, struct decl_state *c
static struct token *pointer(struct token *token, struct decl_state *ctx)
{
- unsigned long modifiers;
- struct symbol *base_type;
-
- modifiers = ctx->ctype.modifiers;
- base_type = ctx->ctype.base_type;
-
while (match_op(token,'*')) {
struct symbol *ptr = alloc_symbol(token->pos, SYM_PTR);
- ptr->ctype.modifiers = modifiers;
+ ptr->ctype.modifiers = ctx->ctype.modifiers;
+ ptr->ctype.base_type = ctx->ctype.base_type;
ptr->ctype.as = ctx->ctype.as;
- concat_ptr_list((struct ptr_list *)ctx->ctype.contexts,
- (struct ptr_list **)&ptr->ctype.contexts);
- ptr->ctype.base_type = base_type;
-
- base_type = ptr;
+ ptr->ctype.contexts = ctx->ctype.contexts;
ctx->ctype.modifiers = 0;
- ctx->ctype.base_type = base_type;
+ ctx->ctype.base_type = ptr;
ctx->ctype.as = 0;
- free_ptr_list(&ctx->ctype.contexts);
+ ctx->ctype.contexts = NULL;
token = handle_qualifiers(token->next, ctx);
- modifiers = ctx->ctype.modifiers;
ctx->ctype.base_type->endpos = token->pos;
}
return token;