[前][次][番号順一覧][スレッド一覧]

ruby-changes:62155

From: Nobuyoshi <ko1@a...>
Date: Wed, 8 Jul 2020 21:35:16 +0900 (JST)
Subject: [ruby-changes:62155] 6a05532315 (master): Constified NODE pointer in ASTNodeData

https://git.ruby-lang.org/ruby.git/commit/?id=6a05532315

From 6a0553231547644f06c9f16f0e28e0337185fb79 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 8 Jul 2020 18:07:30 +0900
Subject: Constified NODE pointer in ASTNodeData


diff --git a/ast.c b/ast.c
index 575458f..6650966 100644
--- a/ast.c
+++ b/ast.c
@@ -17,7 +17,7 @@ static VALUE rb_cNode; https://github.com/ruby/ruby/blob/trunk/ast.c#L17
 
 struct ASTNodeData {
     rb_ast_t *ast;
-    NODE *node;
+    const NODE *node;
 };
 
 static void
@@ -44,7 +44,7 @@ static const rb_data_type_t rb_node_type = { https://github.com/ruby/ruby/blob/trunk/ast.c#L44
 static VALUE rb_ast_node_alloc(VALUE klass);
 
 static void
-setup_node(VALUE obj, rb_ast_t *ast, NODE *node)
+setup_node(VALUE obj, rb_ast_t *ast, const NODE *node)
 {
     struct ASTNodeData *data;
 
@@ -54,7 +54,7 @@ setup_node(VALUE obj, rb_ast_t *ast, NODE *node) https://github.com/ruby/ruby/blob/trunk/ast.c#L54
 }
 
 static VALUE
-ast_new_internal(rb_ast_t *ast, NODE *node)
+ast_new_internal(rb_ast_t *ast, const NODE *node)
 {
     VALUE obj;
 
@@ -145,7 +145,7 @@ rb_ast_parse_array(VALUE array) https://github.com/ruby/ruby/blob/trunk/ast.c#L145
     return ast_parse_done(ast);
 }
 
-static VALUE node_children(rb_ast_t*, NODE*);
+static VALUE node_children(rb_ast_t*, const NODE*);
 
 static VALUE
 node_find(VALUE self, const int node_id)
@@ -268,7 +268,7 @@ rb_ary_new_from_node_args(rb_ast_t *ast, long n, ...) https://github.com/ruby/ruby/blob/trunk/ast.c#L268
 }
 
 static VALUE
-dump_block(rb_ast_t *ast, NODE *node)
+dump_block(rb_ast_t *ast, const NODE *node)
 {
     VALUE ary = rb_ary_new();
     do {
@@ -284,7 +284,7 @@ dump_block(rb_ast_t *ast, NODE *node) https://github.com/ruby/ruby/blob/trunk/ast.c#L284
 }
 
 static VALUE
-dump_array(rb_ast_t *ast, NODE *node)
+dump_array(rb_ast_t *ast, const NODE *node)
 {
     VALUE ary = rb_ary_new();
     rb_ary_push(ary, NEW_CHILD(ast, node->nd_head));
@@ -307,7 +307,7 @@ var_name(ID id) https://github.com/ruby/ruby/blob/trunk/ast.c#L307
 }
 
 static VALUE
-node_children(rb_ast_t *ast, NODE *node)
+node_children(rb_ast_t *ast, const NODE *node)
 {
     char name[DECIMAL_SIZE_OF_BITS(sizeof(long) * CHAR_BIT) + 2]; /* including '$' */
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]