summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-08 04:05:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-08 04:05:59 +0000
commit893ee3097885c83df17273d7de5ed54438de5d20 (patch)
treec1808c71a82b5ce53683afd00c65b95accca952a /iseq.c
parent6a1a57d13b4358f718a3b5037cefd2d00bbb48d2 (diff)
* compile.c (iseq_build_from_ary), iseq.c (iseq_load): fix for format change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/iseq.c b/iseq.c
index cde2c99..2b2b855 100644
--- a/iseq.c
+++ b/iseq.c
@@ -323,48 +323,48 @@ VALUE iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
#define CHECK_ARRAY(v) rb_convert_type(v, T_ARRAY, "Array", "to_ary")
#define CHECK_STRING(v) rb_convert_type(v, T_STRING, "String", "to_str")
#define CHECK_SYMBOL(v) rb_convert_type(v, T_SYMBOL, "Symbol", "to_sym")
-#define CHECK_INTEGER(v) (NUM2LONG(v), v)
+static inline VALUE CHECK_INTEGER(VALUE v) {NUM2LONG(v); return v;}
VALUE
iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
{
VALUE iseqval = iseq_alloc(rb_cISeq);
VALUE magic, version1, version2, format_type, misc;
- VALUE name, filename, line;
+ VALUE name, filename;
VALUE type, body, locals, args, exception;
VALUE iseq_type;
struct st_table *type_map = 0;
rb_iseq_t *iseq;
rb_compile_option_t option;
+ int i = 0;
/* [magic, major_version, minor_version, format_type, misc,
- * name, filename, line,
+ * name, filename,
* type, locals, args, exception_table, body]
*/
data = CHECK_ARRAY(data);
- magic = CHECK_STRING(rb_ary_entry(data, 0));
- version1 = CHECK_INTEGER(rb_ary_entry(data, 1));
- version2 = CHECK_INTEGER(rb_ary_entry(data, 2));
- format_type = CHECK_INTEGER(rb_ary_entry(data, 3));
- misc = rb_ary_entry(data, 4); /* TODO */
+ magic = CHECK_STRING(rb_ary_entry(data, i++));
+ version1 = CHECK_INTEGER(rb_ary_entry(data, i++));
+ version2 = CHECK_INTEGER(rb_ary_entry(data, i++));
+ format_type = CHECK_INTEGER(rb_ary_entry(data, i++));
+ misc = rb_ary_entry(data, i++); /* TODO */
- name = CHECK_STRING(rb_ary_entry(data, 5));
- filename = CHECK_STRING(rb_ary_entry(data, 6));
- line = CHECK_ARRAY(rb_ary_entry(data, 7));
+ name = CHECK_STRING(rb_ary_entry(data, i++));
+ filename = CHECK_STRING(rb_ary_entry(data, i++));
- type = CHECK_SYMBOL(rb_ary_entry(data, 8));
- locals = CHECK_ARRAY(rb_ary_entry(data, 9));
+ type = CHECK_SYMBOL(rb_ary_entry(data, i++));
+ locals = CHECK_ARRAY(rb_ary_entry(data, i++));
- args = rb_ary_entry(data, 10);
+ args = rb_ary_entry(data, i++);
if (FIXNUM_P(args) || (args = CHECK_ARRAY(args))) {
/* */
}
- exception = CHECK_ARRAY(rb_ary_entry(data, 11));
- body = CHECK_ARRAY(rb_ary_entry(data, 12));
+ exception = CHECK_ARRAY(rb_ary_entry(data, i++));
+ body = CHECK_ARRAY(rb_ary_entry(data, i++));
GetISeqPtr(iseqval, iseq);
iseq->self = iseqval;