summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-13 15:55:09 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-13 15:55:09 +0000
commit89e6910f04bb7dcb4d1b3879b8e98295bc20271d (patch)
tree4175c82a68e4de62e382568d5d255736b8b2b9ac /complex.c
parent8ccd658e5467da884f40260e695268965f8d5d06 (diff)
* include/ruby/ruby.h: constify RRational::(num,den) and
RComplex::(real,imag). Add macro to set these values: * RRATIONAL_SET_NUM() * RRATIONAL_SET_DEN() * RCOMPLEX_SET_REAL() * RCOMPLEX_SET_IMAG() This change is a part of RGENGC branch [ruby-trunk - Feature #8339]. TODO: API design. RRATIONAL_SET(rat,num,den) is enough? TODO: Setting constify variable with cast has same issue of r40691. * complex.c, rational.c: use above macros. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/complex.c b/complex.c
index de3a538c6c..8420c190eb 100644
--- a/complex.c
+++ b/complex.c
@@ -315,8 +315,8 @@ nucomp_s_new_internal(VALUE klass, VALUE real, VALUE imag)
{
NEWOBJ_OF(obj, struct RComplex, klass, T_COMPLEX);
- obj->real = real;
- obj->imag = imag;
+ RCOMPLEX_SET_REAL(obj, real);
+ RCOMPLEX_SET_IMAG(obj, imag);
return (VALUE)obj;
}
@@ -1332,8 +1332,8 @@ nucomp_loader(VALUE self, VALUE a)
{
get_dat1(self);
- dat->real = rb_ivar_get(a, id_i_real);
- dat->imag = rb_ivar_get(a, id_i_imag);
+ RCOMPLEX_SET_REAL(dat, rb_ivar_get(a, id_i_real));
+ RCOMPLEX_SET_IMAG(dat, rb_ivar_get(a, id_i_imag));
return self;
}