use allocate_statement_zero for allocating statements
authorMatthias Braun <matze@braunis.de>
Wed, 12 Dec 2007 10:45:08 +0000 (10:45 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 12 Dec 2007 10:45:08 +0000 (10:45 +0000)
[r18706]

parser.c

index dd71411..6e95e80 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -5199,20 +5199,20 @@ static statement_t *parse_goto(void)
  */
 static statement_t *parse_continue(void)
 {
-       statement_base_t *statement;
+       statement_t *statement;
        if (current_loop == NULL) {
                errorf(HERE, "continue statement not within loop");
                statement = NULL;
        } else {
-               statement                  = allocate_ast_zero(sizeof(statement[0]));
-               statement->kind            = STATEMENT_CONTINUE;
-               statement->source_position = token.source_position;
+               statement = allocate_statement_zero(STATEMENT_CONTINUE);
+
+               statement->base.source_position = token.source_position;
        }
 
        eat(T_continue);
        expect(';');
 
-       return (statement_t*)statement;
+       return statement;
 }
 
 /**
@@ -5220,20 +5220,20 @@ static statement_t *parse_continue(void)
  */
 static statement_t *parse_break(void)
 {
-       statement_base_t *statement;
+       statement_t *statement;
        if (current_switch == NULL && current_loop == NULL) {
                errorf(HERE, "break statement not within loop or switch");
                statement = NULL;
        } else {
-               statement                  = allocate_ast_zero(sizeof(statement[0]));
-               statement->kind            = STATEMENT_BREAK;
-               statement->source_position = token.source_position;
+               statement = allocate_statement_zero(STATEMENT_BREAK);
+
+               statement->base.source_position = token.source_position;
        }
 
        eat(T_break);
        expect(';');
 
-       return (statement_t*)statement;
+       return statement;
 }
 
 /**