ast: simplify AppendStmt

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-10-11 21:50:21 +02:00
parent bbf388ec1f
commit 89523789ca
1 changed files with 9 additions and 13 deletions

View File

@ -68,21 +68,17 @@ malloc_or_die(size_t size)
} }
ParseCommon * ParseCommon *
AppendStmt(ParseCommon * to, ParseCommon * append) AppendStmt(ParseCommon *to, ParseCommon *append)
{ {
ParseCommon *start = to; ParseCommon *iter;
if (append == NULL) if (!to)
return to; return append;
while ((to != NULL) && (to->next != NULL))
{ for (iter = to; iter->next; iter = iter->next);
to = to->next;
} iter->next = append;
if (to) { return to;
to->next = append;
return start;
}
return append;
} }
ExprDef * ExprDef *