From 5ffc39352ef0195697953e9318b8a17c79e7ae84 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 20 May 2023 18:41:54 +0300 Subject: document ast.h --- src/ast.c | 15 +++++++-------- src/parser_helper.c | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/ast.c b/src/ast.c index f632624..2719dd3 100644 --- a/src/ast.c +++ b/src/ast.c @@ -3027,23 +3027,22 @@ size_t ast_list_len(struct ast_node *node) return count; } -struct ast_node *ast_last_node(struct ast_node *n) +struct ast_node *ast_last_node(struct ast_node *list) { - if (!n) + if (!list) return NULL; - while (n->next) - n = n->next; + while (list->next) + list = list->next; - return n; + return list; } -struct ast_node *ast_block_last(struct ast_node *n) +struct ast_node *ast_block_last(struct ast_node *block) { - struct ast_node *b = ast_last_node(n); + struct ast_node *b = ast_last_node(block); if (b && b->node_type == AST_BLOCK) return ast_block_last(b->_block.body); return b; } - diff --git a/src/parser_helper.c b/src/parser_helper.c index 5a90df8..2ac3f0d 100644 --- a/src/parser_helper.c +++ b/src/parser_helper.c @@ -28,7 +28,6 @@ void parse(struct parser *p, const char *fname, const char *buf) p->fname = fname; p->buf = buf; - p->buf_offset = 0; p->comment_nesting = 0; p->failed = false; -- cgit v1.3