Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
- Remove redundant type cast
- Fix Qnil to 0 as a member of rb_parser_ary_t is not a VALUE
- Delete unused line
  • Loading branch information
hasumikin committed Feb 26, 2024
1 parent 4cbd48e commit 9c64383
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions node.c
Expand Up @@ -188,7 +188,7 @@ static void
parser_ast_token_free(rb_ast_t *ast, rb_parser_ast_token_t *token)
{
if (!token) return;
parser_string_free(ast, (rb_parser_string_t *)token->str);
parser_string_free(ast, token->str);
xfree(token);
}

Expand Down Expand Up @@ -259,8 +259,6 @@ free_ast_value(rb_ast_t *ast, void *ctx, NODE *node)
static void
ast_tokens_free(rb_ast_t *ast)
{
rb_parser_ary_t *tokens;

if (!ast || !ast->node_buffer) return;
parser_ary_free(ast, ast->node_buffer->tokens);
}
Expand Down
4 changes: 2 additions & 2 deletions parse.y
Expand Up @@ -2600,7 +2600,7 @@ rb_parser_ary_extend(rb_parser_t *p, rb_parser_ary_t *ary, long len)
ary->data = xrealloc(ary->data, sizeof(void *) * len);
}
for (i = ary->len; i < len; i++) {
ary->data[i] = Qnil;
ary->data[i] = 0;
}
}
}
Expand All @@ -2622,7 +2622,7 @@ rb_parser_ary_new_capa(rb_parser_t *p, long len)
ary->data = NULL;
}
for (i = 0; i < len; i++) {
ary->data[i] = Qnil;
ary->data[i] = 0;
}
return ary;
}
Expand Down

0 comments on commit 9c64383

Please sign in to comment.