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

ruby-changes:39287

From: ko1 <ko1@a...>
Date: Sat, 25 Jul 2015 06:01:21 +0900 (JST)
Subject: [ruby-changes:39287] ko1:r51368 (trunk): * vm_core.h: constify rb_iseq_constant_body::line_info_table.

ko1	2015-07-25 06:01:09 +0900 (Sat, 25 Jul 2015)

  New Revision: 51368

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51368

  Log:
    * vm_core.h: constify rb_iseq_constant_body::line_info_table.
    * iseq.c: catch up this fix.

  Modified files:
    trunk/ChangeLog
    trunk/iseq.c
    trunk/vm_core.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51367)
+++ ChangeLog	(revision 51368)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jul 25 06:00:09 2015  Koichi Sasada  <ko1@a...>
+
+	* vm_core.h: constify rb_iseq_constant_body::line_info_table.
+
+	* iseq.c: catch up this fix.
+
 Sat Jul 25 05:56:43 2015  Koichi Sasada  <ko1@a...>
 
 	* vm_core.h: constify rb_iseq_constant_body::param::opt_table and
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 51367)
+++ vm_core.h	(revision 51368)
@@ -330,7 +330,7 @@ struct rb_iseq_constant_body { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L330
     rb_iseq_location_t location;
 
     /* insn info, must be freed */
-    struct iseq_line_info_entry *line_info_table;
+    const struct iseq_line_info_entry *line_info_table;
 
     const ID *local_table;		/* must free */
 
Index: iseq.c
===================================================================
--- iseq.c	(revision 51367)
+++ iseq.c	(revision 51368)
@@ -1060,11 +1060,11 @@ iseqw_to_a(VALUE self) https://github.com/ruby/ruby/blob/trunk/iseq.c#L1060
 /* TODO: search algorithm is brute force.
          this should be binary search or so. */
 
-static struct iseq_line_info_entry *
+static const struct iseq_line_info_entry *
 get_line_info(const rb_iseq_t *iseq, size_t pos)
 {
     size_t i = 0, size = iseq->body->line_info_size;
-    struct iseq_line_info_entry *table = iseq->body->line_info_table;
+    const struct iseq_line_info_entry *table = iseq->body->line_info_table;
     const int debug = 0;
 
     if (debug) {
@@ -1098,7 +1098,8 @@ get_line_info(const rb_iseq_t *iseq, siz https://github.com/ruby/ruby/blob/trunk/iseq.c#L1098
 static unsigned int
 find_line_no(const rb_iseq_t *iseq, size_t pos)
 {
-    struct iseq_line_info_entry *entry = get_line_info(iseq, pos);
+    const struct iseq_line_info_entry *entry = get_line_info(iseq, pos);
+
     if (entry) {
 	return entry->line_no;
     }

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

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