summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-16 22:05:58 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-16 22:05:58 +0000
commita0e62485d41ed9bd8dfbe826a72b567429359fe5 (patch)
tree816e2c64b0996d84dcde19c5c05d2f4b5443fba2
parent457e481b20b038630f63b5d6138a41fc327e6a20 (diff)
* iseq.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--iseq.c20
2 files changed, 14 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 0688bcaa39..5409f279de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Dec 17 07:04:09 2010 Tanaka Akira <akr@fsij.org>
+
+ * iseq.c: parenthesize macro arguments.
+
Fri Dec 17 04:18:37 2010 Eric Hodel <drbrain@segment7.net>
* transcode.c (str_encode): Alter comment for better wording and ri
diff --git a/iseq.c b/iseq.c
index 8b4ed02a13..f563e95e54 100644
--- a/iseq.c
+++ b/iseq.c
@@ -325,13 +325,13 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
*option = COMPILE_OPTION_DEFAULT;
#define SET_COMPILE_OPTION(o, h, mem) \
- { VALUE flag = rb_hash_aref(h, ID2SYM(rb_intern(#mem))); \
- if (flag == Qtrue) { o->mem = 1; } \
- else if (flag == Qfalse) { o->mem = 0; } \
+ { VALUE flag = rb_hash_aref((h), ID2SYM(rb_intern(#mem))); \
+ if (flag == Qtrue) { (o)->mem = 1; } \
+ else if (flag == Qfalse) { (o)->mem = 0; } \
}
#define SET_COMPILE_OPTION_NUM(o, h, mem) \
{ VALUE num = rb_hash_aref(opt, ID2SYM(rb_intern(#mem))); \
- if (!NIL_P(num)) o->mem = NUM2INT(num); \
+ if (!NIL_P(num)) (o)->mem = NUM2INT(num); \
}
SET_COMPILE_OPTION(option, opt, inline_const_cache);
SET_COMPILE_OPTION(option, opt, peephole_optimization);
@@ -355,9 +355,9 @@ make_compile_option_value(rb_compile_option_t *option)
{
VALUE opt = rb_hash_new();
#define SET_COMPILE_OPTION(o, h, mem) \
- rb_hash_aset(h, ID2SYM(rb_intern(#mem)), o->mem ? Qtrue : Qfalse)
+ rb_hash_aset((h), ID2SYM(rb_intern(#mem)), (o)->mem ? Qtrue : Qfalse)
#define SET_COMPILE_OPTION_NUM(o, h, mem) \
- rb_hash_aset(h, ID2SYM(rb_intern(#mem)), INT2NUM(o->mem))
+ rb_hash_aset((h), ID2SYM(rb_intern(#mem)), INT2NUM((o)->mem))
{
SET_COMPILE_OPTION(option, opt, inline_const_cache);
SET_COMPILE_OPTION(option, opt, peephole_optimization);
@@ -433,9 +433,9 @@ rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE filename, VALUE filepath, VA
bopt, &COMPILE_OPTION_DEFAULT);
}
-#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_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")
static inline VALUE CHECK_INTEGER(VALUE v) {(void)NUM2LONG(v); return v;}
static VALUE
iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
@@ -1382,7 +1382,7 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
VALUE a, args = rb_ary_new2(iseq->arg_size);
ID req, opt, rest, block;
#define PARAM_TYPE(type) rb_ary_push(a = rb_ary_new2(2), ID2SYM(type))
-#define PARAM_ID(i) iseq->local_table[i]
+#define PARAM_ID(i) iseq->local_table[(i)]
#define PARAM(i, type) ( \
PARAM_TYPE(type), \
rb_id2name(PARAM_ID(i)) ? \