summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-26 00:36:08 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-26 00:36:08 +0000
commitdd5ad24735bebabb7e20df7b408c33b34f784b8f (patch)
tree543a6d08f0d5978193e3a87d4bcb2cb277d61a8f
parent326ec51f4ec024c32d3b73ae301d830b052c4e7b (diff)
* rational.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--rational.c28
2 files changed, 18 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 22fe98ab64..79bd979e09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Dec 26 09:35:07 2010 Tanaka Akira <akr@fsij.org>
+
+ * rational.c: parenthesize macro arguments.
+
Sun Dec 26 09:22:19 2010 Tanaka Akira <akr@fsij.org>
* ext/socket/option.c (rb_if_indextoname): new function to abstract
diff --git a/rational.c b/rational.c
index c795af1fed..00b09409af 100644
--- a/rational.c
+++ b/rational.c
@@ -32,7 +32,7 @@ static ID id_abs, id_cmp, id_convert, id_eqeq_p, id_expt, id_fdiv,
inline static VALUE \
f_##n(VALUE x, VALUE y)\
{\
- return rb_funcall(x, op, 1, y);\
+ return rb_funcall(x, (op), 1, y);\
}
#define fun1(n) \
@@ -1364,12 +1364,12 @@ nurat_to_r(VALUE self)
}
#define id_ceil rb_intern("ceil")
-#define f_ceil(x) rb_funcall(x, id_ceil, 0)
+#define f_ceil(x) rb_funcall((x), id_ceil, 0)
#define id_quo rb_intern("quo")
-#define f_quo(x,y) rb_funcall(x, id_quo, 1, y)
+#define f_quo(x,y) rb_funcall((x), id_quo, 1, (y))
-#define f_reciprocal(x) f_quo(ONE, x)
+#define f_reciprocal(x) f_quo(ONE, (x))
/*
The algorithm here is the method described in CLISP. Bruno Haible has
@@ -1689,13 +1689,13 @@ rb_Rational(VALUE x, VALUE y)
}
#define id_numerator rb_intern("numerator")
-#define f_numerator(x) rb_funcall(x, id_numerator, 0)
+#define f_numerator(x) rb_funcall((x), id_numerator, 0)
#define id_denominator rb_intern("denominator")
-#define f_denominator(x) rb_funcall(x, id_denominator, 0)
+#define f_denominator(x) rb_funcall((x), id_denominator, 0)
#define id_to_r rb_intern("to_r")
-#define f_to_r(x) rb_funcall(x, id_to_r, 0)
+#define f_to_r(x) rb_funcall((x), id_to_r, 0)
/*
* call-seq:
@@ -1866,7 +1866,7 @@ float_decode(VALUE self)
#endif
#define id_lshift rb_intern("<<")
-#define f_lshift(x,n) rb_funcall(x, id_lshift, 1, n)
+#define f_lshift(x,n) rb_funcall((x), id_lshift, 1, (n))
/*
* call-seq:
@@ -2000,16 +2000,16 @@ make_patterns(void)
}
#define id_match rb_intern("match")
-#define f_match(x,y) rb_funcall(x, id_match, 1, y)
+#define f_match(x,y) rb_funcall((x), id_match, 1, (y))
#define id_aref rb_intern("[]")
-#define f_aref(x,y) rb_funcall(x, id_aref, 1, y)
+#define f_aref(x,y) rb_funcall((x), id_aref, 1, (y))
#define id_post_match rb_intern("post_match")
-#define f_post_match(x) rb_funcall(x, id_post_match, 0)
+#define f_post_match(x) rb_funcall((x), id_post_match, 0)
#define id_split rb_intern("split")
-#define f_split(x,y) rb_funcall(x, id_split, 1, y)
+#define f_split(x,y) rb_funcall((x), id_split, 1, (y))
#include <ctype.h>
@@ -2097,7 +2097,7 @@ string_to_r_strict(VALUE self)
}
#define id_gsub rb_intern("gsub")
-#define f_gsub(x,y,z) rb_funcall(x, id_gsub, 2, y, z)
+#define f_gsub(x,y,z) rb_funcall((x), id_gsub, 2, (y), (z))
/*
* call-seq:
@@ -2141,7 +2141,7 @@ string_to_r(VALUE self)
}
#define id_to_r rb_intern("to_r")
-#define f_to_r(x) rb_funcall(x, id_to_r, 0)
+#define f_to_r(x) rb_funcall((x), id_to_r, 0)
static VALUE
nurat_s_convert(int argc, VALUE *argv, VALUE klass)