diff options
author | Ran Benita <ran234@gmail.com> | 2012-10-11 21:50:21 +0200 |
---|---|---|
committer | Ran Benita <ran234@gmail.com> | 2012-10-11 21:51:08 +0200 |
commit | 89523789cadf407464135068a8437897820e4299 (patch) | |
tree | f41d94b296a4c8c4df4ed3ee4c14a9429d0ad047 | |
parent | bbf388ec1f632f648b0e1323fe90c251c0425bf7 (diff) |
ast: simplify AppendStmt
Signed-off-by: Ran Benita <ran234@gmail.com>
-rw-r--r-- | src/xkbcomp/ast-build.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/xkbcomp/ast-build.c b/src/xkbcomp/ast-build.c index 4ce4752..ad249ad 100644 --- a/src/xkbcomp/ast-build.c +++ b/src/xkbcomp/ast-build.c @@ -68,21 +68,17 @@ malloc_or_die(size_t size) } ParseCommon * -AppendStmt(ParseCommon * to, ParseCommon * append) +AppendStmt(ParseCommon *to, ParseCommon *append) { - ParseCommon *start = to; + ParseCommon *iter; - if (append == NULL) - return to; - while ((to != NULL) && (to->next != NULL)) - { - to = to->next; - } - if (to) { - to->next = append; - return start; - } - return append; + if (!to) + return append; + + for (iter = to; iter->next; iter = iter->next); + + iter->next = append; + return to; } ExprDef * |